Skip to content

Commit e7fc5f5

Browse files
authored
Support sort expression pushdown for SortMergeJoin (#4830)
* Support sort expression pushdown for SortMergeJoin Signed-off-by: Songkan Tang <songkant@amazon.com> * Remove old duplicate methods in CalciteLogicalIndexScan Signed-off-by: Songkan Tang <songkant@amazon.com> * Add more tests Signed-off-by: Songkan Tang <songkant@amazon.com> --------- Signed-off-by: Songkan Tang <songkant@amazon.com>
1 parent 5f963a0 commit e7fc5f5

17 files changed

Lines changed: 431 additions & 127 deletions

integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,48 @@ public void testSortComplexExprMixedWithSimpleExpr() throws Exception {
10121012
assertYamlEqualsIgnoreId(expected, result);
10131013
}
10141014

1015+
@Test
1016+
public void testComplexSortExprPushdownForSMJ() throws Exception {
1017+
String query =
1018+
"source=opensearch-sql_test_index_bank | rex field=lastname \\\"(?<initial>^[A-Z])\\\" |"
1019+
+ " join left=a right=b on a.initial = b.firstname opensearch-sql_test_index_bank";
1020+
var result = explainQueryYaml(query);
1021+
String expected = loadExpectedPlan("explain_complex_sort_expr_pushdown_for_smj.yaml");
1022+
assertYamlEqualsIgnoreId(expected, result);
1023+
}
1024+
1025+
@Test
1026+
public void testSimpleSortExprPushdownForSMJ() throws Exception {
1027+
String query =
1028+
"source=opensearch-sql_test_index_bank | join left=a right=b on a.age + 1 = b.balance - 20"
1029+
+ " opensearch-sql_test_index_bank";
1030+
var result = explainQueryYaml(query);
1031+
String expected = loadExpectedPlan("explain_simple_sort_expr_pushdown_for_smj.yaml");
1032+
assertYamlEqualsIgnoreId(expected, result);
1033+
}
1034+
1035+
@Test
1036+
public void testSortPassThroughJoinThenPushdown() throws Exception {
1037+
String query =
1038+
"source=opensearch-sql_test_index_bank | rex field=lastname \\\"(?<initial>^[A-Z])\\\" |"
1039+
+ " join type=left left=a right=b on a.initial = b.firstname"
1040+
+ " opensearch-sql_test_index_bank | sort initial";
1041+
var result = explainQueryYaml(query);
1042+
String expected = loadExpectedPlan("explain_sort_pass_through_join_then_pushdown.yaml");
1043+
assertYamlEqualsIgnoreId(expected, result);
1044+
}
1045+
1046+
@Test
1047+
public void testComplexSortExprPushdownForSMJWithMaxOption() throws Exception {
1048+
String query =
1049+
"source=opensearch-sql_test_index_bank | rex field=lastname \\\"(?<lastname>^[A-Z])\\\" |"
1050+
+ " join type=left max=1 lastname opensearch-sql_test_index_bank";
1051+
var result = explainQueryYaml(query);
1052+
String expected =
1053+
loadExpectedPlan("explain_complex_sort_expr_pushdown_for_smj_w_max_option.yaml");
1054+
assertYamlEqualsIgnoreId(expected, result);
1055+
}
1056+
10151057
@Test
10161058
public void testRexExplain() throws IOException {
10171059
String query =

integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLJoinIT.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,4 +956,73 @@ public void testJoinSubsearchMaxOut() throws IOException {
956956
TEST_INDEX_STATE_COUNTRY, TEST_INDEX_OCCUPATION));
957957
verifyNumOfRows(actual, 15);
958958
}
959+
960+
@Test
961+
public void testSimpleSortPushDownForSMJ() throws IOException {
962+
JSONObject actual =
963+
executeQuery(
964+
String.format(
965+
"source=%s | join left=a right=b on a.age + 3 = b.age - 2 %s | fields name, age,"
966+
+ " b.name, b.age",
967+
TEST_INDEX_STATE_COUNTRY, TEST_INDEX_STATE_COUNTRY));
968+
verifySchema(
969+
actual,
970+
schema("name", "string"),
971+
schema("age", "int"),
972+
schema("b.name", "string"),
973+
schema("b.age", "int"));
974+
verifyDataRows(actual, rows("Jane", 20, "John", 25), rows("John", 25, "Hello", 30));
975+
}
976+
977+
@Test
978+
public void testComplexSortPushDownForSMJ() throws IOException {
979+
JSONObject actual =
980+
executeQuery(
981+
String.format(
982+
"source=%s | eval name2=substring(name, 2, 1) | join left=a right=b on a.name2 ="
983+
+ " b.state2 [ source=%s | eval state2=substring(state, 2, 1) ] | fields name,"
984+
+ " name2, b.name, b.state, state2",
985+
TEST_INDEX_STATE_COUNTRY, TEST_INDEX_STATE_COUNTRY));
986+
verifySchema(
987+
actual,
988+
schema("name", "string"),
989+
schema("name2", "string"),
990+
schema("b.name", "string"),
991+
schema("b.state", "string"),
992+
schema("state2", "string"));
993+
verifyDataRows(
994+
actual,
995+
rows("Jake", "a", "Jake", "California", "a"),
996+
rows("Jake", "a", "David", "Washington", "a"),
997+
rows("Jane", "a", "Jake", "California", "a"),
998+
rows("Jane", "a", "David", "Washington", "a"),
999+
rows("David", "a", "Jake", "California", "a"),
1000+
rows("David", "a", "David", "Washington", "a"),
1001+
rows("Hello", "e", "Hello", "New York", "e"),
1002+
rows("Peter", "e", "Hello", "New York", "e"));
1003+
}
1004+
1005+
@Test
1006+
public void testComplexSortPushDownForSMJWithMaxOptionAndFieldList() throws IOException {
1007+
JSONObject actual =
1008+
executeQuery(
1009+
String.format(
1010+
"source=%s | eval name2=substring(name, 2, 1) | join max=1 name2,age [ source=%s |"
1011+
+ " eval name2=substring(state, 2, 1) ]",
1012+
TEST_INDEX_STATE_COUNTRY, TEST_INDEX_STATE_COUNTRY));
1013+
verifySchema(
1014+
actual,
1015+
schema("name", "string"),
1016+
schema("country", "string"),
1017+
schema("state", "string"),
1018+
schema("month", "int"),
1019+
schema("year", "int"),
1020+
schema("age", "int"),
1021+
schema("name2", "string"));
1022+
verifyDataRows(
1023+
actual,
1024+
rows("David", "USA", "Washington", 4, 2023, 40, "a"),
1025+
rows("Jake", "USA", "California", 4, 2023, 70, "a"),
1026+
rows("Hello", "USA", "New York", 4, 2023, 30, "e"));
1027+
}
9591028
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
calcite:
2+
logical: |
3+
LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
4+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], initial=[$13], b.account_number=[$14], b.firstname=[$15], b.address=[$16], b.birthdate=[$17], b.gender=[$18], b.city=[$19], b.lastname=[$20], b.balance=[$21], b.employer=[$22], b.state=[$23], b.age=[$24], b.email=[$25], b.male=[$26])
5+
LogicalJoin(condition=[=($13, $15)], joinType=[inner])
6+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], initial=[REX_EXTRACT($6, '(?<initial>^[A-Z])', 'initial')])
7+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
8+
LogicalSystemLimit(fetch=[50000], type=[JOIN_SUBSEARCH_MAXOUT])
9+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12])
10+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
11+
physical: |
12+
EnumerableLimit(fetch=[10000])
13+
EnumerableMergeJoin(condition=[=($13, $15)], joinType=[inner])
14+
EnumerableCalc(expr#0..12=[{inputs}], expr#13=['(?<initial>^[A-Z])'], expr#14=['initial'], expr#15=[REX_EXTRACT($t6, $t13, $t14)], proj#0..12=[{exprs}], $f13=[$t15])
15+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], SORT_EXPR->[REX_EXTRACT($6, '(?<initial>^[A-Z])', 'initial') ASCENDING NULLS_LAST]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"timeout":"1m","_source":{"includes":["account_number","firstname","address","birthdate","gender","city","lastname","balance","employer","state","age","email","male"],"excludes":[]},"sort":[{"_script":{"script":{"source":"{\"langType\":\"calcite\",\"script\":\"rO0ABXQC5nsKICAib3AiOiB7CiAgICAibmFtZSI6ICJSRVhfRVhUUkFDVCIsCiAgICAia2luZCI6ICJPVEhFUl9GVU5DVElPTiIsCiAgICAic3ludGF4IjogIkZVTkNUSU9OIgogIH0sCiAgIm9wZXJhbmRzIjogWwogICAgewogICAgICAiZHluYW1pY1BhcmFtIjogMCwKICAgICAgInR5cGUiOiB7CiAgICAgICAgInR5cGUiOiAiVkFSQ0hBUiIsCiAgICAgICAgIm51bGxhYmxlIjogdHJ1ZSwKICAgICAgICAicHJlY2lzaW9uIjogLTEKICAgICAgfQogICAgfSwKICAgIHsKICAgICAgImR5bmFtaWNQYXJhbSI6IDEsCiAgICAgICJ0eXBlIjogewogICAgICAgICJ0eXBlIjogIkNIQVIiLAogICAgICAgICJudWxsYWJsZSI6IGZhbHNlLAogICAgICAgICJwcmVjaXNpb24iOiAxOAogICAgICB9CiAgICB9LAogICAgewogICAgICAiZHluYW1pY1BhcmFtIjogMiwKICAgICAgInR5cGUiOiB7CiAgICAgICAgInR5cGUiOiAiQ0hBUiIsCiAgICAgICAgIm51bGxhYmxlIjogZmFsc2UsCiAgICAgICAgInByZWNpc2lvbiI6IDcKICAgICAgfQogICAgfQogIF0sCiAgImNsYXNzIjogIm9yZy5vcGVuc2VhcmNoLnNxbC5leHByZXNzaW9uLmZ1bmN0aW9uLlVzZXJEZWZpbmVkRnVuY3Rpb25CdWlsZGVyJDEiLAogICJ0eXBlIjogewogICAgInR5cGUiOiAiVkFSQ0hBUiIsCiAgICAibnVsbGFibGUiOiB0cnVlLAogICAgInByZWNpc2lvbiI6IDIwMDAKICB9LAogICJkZXRlcm1pbmlzdGljIjogdHJ1ZSwKICAiZHluYW1pYyI6IGZhbHNlCn0=\"}","lang":"opensearch_compounded_script","params":{"MISSING_MAX":true,"utcTimestamp": 0,"SOURCES":[0,2,2],"DIGESTS":["lastname","(?<initial>^[A-Z])","initial"]}},"type":"string","order":"asc"}}]}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
16+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], LIMIT->50000, SORT->[{
17+
"firstname" : {
18+
"order" : "asc",
19+
"missing" : "_last"
20+
}
21+
}]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":50000,"timeout":"1m","_source":{"includes":["account_number","firstname","address","birthdate","gender","city","lastname","balance","employer","state","age","email","male"],"excludes":[]},"sort":[{"firstname":{"order":"asc","missing":"_last"}}]}, requestedTotalSize=50000, pageSize=null, startFrom=0)])
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
calcite:
2+
logical: |
3+
LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
4+
LogicalProject(account_number=[$13], firstname=[$14], address=[$15], birthdate=[$16], gender=[$17], city=[$18], lastname=[$19], balance=[$20], employer=[$21], state=[$22], age=[$23], email=[$24], male=[$25])
5+
LogicalJoin(condition=[=($12, $19)], joinType=[left])
6+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], lastname=[REX_EXTRACT($6, '(?<lastname>^[A-Z])', 'lastname')])
7+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
8+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12])
9+
LogicalFilter(condition=[<=($13, 1)])
10+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], _row_number_join_max_dedup_=[ROW_NUMBER() OVER (PARTITION BY $6 ORDER BY $6)])
11+
LogicalFilter(condition=[IS NOT NULL($6)])
12+
LogicalSystemLimit(fetch=[50000], type=[JOIN_SUBSEARCH_MAXOUT])
13+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12])
14+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
15+
physical: |
16+
EnumerableCalc(expr#0..13=[{inputs}], account_number=[$t1], firstname=[$t2], address=[$t3], birthdate=[$t4], gender=[$t5], city=[$t6], lastname=[$t7], balance=[$t8], employer=[$t9], state=[$t10], age=[$t11], email=[$t12], male=[$t13])
17+
EnumerableLimit(fetch=[10000])
18+
EnumerableMergeJoin(condition=[=($0, $7)], joinType=[left])
19+
EnumerableCalc(expr#0=[{inputs}], expr#1=['(?<lastname>^[A-Z])'], expr#2=['lastname'], expr#3=[REX_EXTRACT($t0, $t1, $t2)], $f0=[$t3])
20+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[lastname], LIMIT->10000, SORT_EXPR->[REX_EXTRACT($0, '(?<lastname>^[A-Z])', 'lastname') ASCENDING NULLS_LAST]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":10000,"timeout":"1m","_source":{"includes":["lastname"],"excludes":[]},"sort":[{"_script":{"script":{"source":"{\"langType\":\"calcite\",\"script\":\"rO0ABXQC5nsKICAib3AiOiB7CiAgICAibmFtZSI6ICJSRVhfRVhUUkFDVCIsCiAgICAia2luZCI6ICJPVEhFUl9GVU5DVElPTiIsCiAgICAic3ludGF4IjogIkZVTkNUSU9OIgogIH0sCiAgIm9wZXJhbmRzIjogWwogICAgewogICAgICAiZHluYW1pY1BhcmFtIjogMCwKICAgICAgInR5cGUiOiB7CiAgICAgICAgInR5cGUiOiAiVkFSQ0hBUiIsCiAgICAgICAgIm51bGxhYmxlIjogdHJ1ZSwKICAgICAgICAicHJlY2lzaW9uIjogLTEKICAgICAgfQogICAgfSwKICAgIHsKICAgICAgImR5bmFtaWNQYXJhbSI6IDEsCiAgICAgICJ0eXBlIjogewogICAgICAgICJ0eXBlIjogIkNIQVIiLAogICAgICAgICJudWxsYWJsZSI6IGZhbHNlLAogICAgICAgICJwcmVjaXNpb24iOiAxOQogICAgICB9CiAgICB9LAogICAgewogICAgICAiZHluYW1pY1BhcmFtIjogMiwKICAgICAgInR5cGUiOiB7CiAgICAgICAgInR5cGUiOiAiQ0hBUiIsCiAgICAgICAgIm51bGxhYmxlIjogZmFsc2UsCiAgICAgICAgInByZWNpc2lvbiI6IDgKICAgICAgfQogICAgfQogIF0sCiAgImNsYXNzIjogIm9yZy5vcGVuc2VhcmNoLnNxbC5leHByZXNzaW9uLmZ1bmN0aW9uLlVzZXJEZWZpbmVkRnVuY3Rpb25CdWlsZGVyJDEiLAogICJ0eXBlIjogewogICAgInR5cGUiOiAiVkFSQ0hBUiIsCiAgICAibnVsbGFibGUiOiB0cnVlLAogICAgInByZWNpc2lvbiI6IDIwMDAKICB9LAogICJkZXRlcm1pbmlzdGljIjogdHJ1ZSwKICAiZHluYW1pYyI6IGZhbHNlCn0=\"}","lang":"opensearch_compounded_script","params":{"MISSING_MAX":true,"utcTimestamp": 0,"SOURCES":[0,2,2],"DIGESTS":["lastname","(?<lastname>^[A-Z])","lastname"]}},"type":"string","order":"asc"}}]}, requestedTotalSize=10000, pageSize=null, startFrom=0)])
21+
EnumerableSort(sort0=[$6], dir0=[ASC])
22+
EnumerableCalc(expr#0..13=[{inputs}], expr#14=[1], expr#15=[<=($t13, $t14)], proj#0..12=[{exprs}], $condition=[$t15])
23+
EnumerableWindow(window#0=[window(partition {6} order by [6] rows between UNBOUNDED PRECEDING and CURRENT ROW aggs [ROW_NUMBER()])])
24+
EnumerableCalc(expr#0..12=[{inputs}], expr#13=[IS NOT NULL($t6)], proj#0..12=[{exprs}], $condition=[$t13])
25+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], LIMIT->50000], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":50000,"timeout":"1m","_source":{"includes":["account_number","firstname","address","birthdate","gender","city","lastname","balance","employer","state","age","email","male"],"excludes":[]}}, requestedTotalSize=50000, pageSize=null, startFrom=0)])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"calcite": {
33
"logical": "LogicalSystemLimit(sort0=[$1], dir0=[ASC-nulls-first], fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(age=[$10], age2=[$19])\n LogicalSort(sort0=[$19], dir0=[ASC-nulls-first])\n LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], _id=[$13], _index=[$14], _score=[$15], _maxscore=[$16], _sort=[$17], _routing=[$18], age2=[+($10, 2)])\n CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])\n",
4-
"physical": "EnumerableCalc(expr#0=[{inputs}], expr#1=[2], expr#2=[+($t0, $t1)], age=[$t0], $f1=[$t2])\n CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[SORT->[{\n \"age\" : {\n \"order\" : \"asc\",\n \"missing\" : \"_first\"\n }\n}], LIMIT->10000, PROJECT->[age]], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"_source\":{\"includes\":[\"age\"],\"excludes\":[]},\"sort\":[{\"age\":{\"order\":\"asc\",\"missing\":\"_first\"}}]}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n"
4+
"physical": "EnumerableCalc(expr#0=[{inputs}], expr#1=[2], expr#2=[+($t0, $t1)], age=[$t0], $f1=[$t2])\n CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[age], SORT->[{\n \"age\" : {\n \"order\" : \"asc\",\n \"missing\" : \"_first\"\n }\n}], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"_source\":{\"includes\":[\"age\"],\"excludes\":[]},\"sort\":[{\"age\":{\"order\":\"asc\",\"missing\":\"_first\"}}]}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n"
55
}
66
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
calcite:
2+
logical: |
3+
LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])
4+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12], b.account_number=[$13], b.firstname=[$14], b.address=[$15], b.birthdate=[$16], b.gender=[$17], b.city=[$18], b.lastname=[$19], b.balance=[$20], b.employer=[$21], b.state=[$22], b.age=[$23], b.email=[$24], b.male=[$25])
5+
LogicalJoin(condition=[=(+($10, 1), -($20, 20))], joinType=[inner])
6+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12])
7+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
8+
LogicalSystemLimit(fetch=[50000], type=[JOIN_SUBSEARCH_MAXOUT])
9+
LogicalProject(account_number=[$0], firstname=[$1], address=[$2], birthdate=[$3], gender=[$4], city=[$5], lastname=[$6], balance=[$7], employer=[$8], state=[$9], age=[$10], email=[$11], male=[$12])
10+
CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])
11+
physical: |
12+
EnumerableCalc(expr#0..27=[{inputs}], proj#0..12=[{exprs}], b.account_number=[$t14], b.firstname=[$t15], b.address=[$t16], b.birthdate=[$t17], b.gender=[$t18], b.city=[$t19], b.lastname=[$t20], b.balance=[$t21], b.employer=[$t22], b.state=[$t23], b.age=[$t24], b.email=[$t25], b.male=[$t26])
13+
EnumerableLimit(fetch=[10000])
14+
EnumerableMergeJoin(condition=[=($13, $27)], joinType=[inner])
15+
EnumerableCalc(expr#0..12=[{inputs}], expr#13=[1], expr#14=[+($t10, $t13)], proj#0..12=[{exprs}], $f13=[$t14])
16+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], SORT->[{
17+
"age" : {
18+
"order" : "asc",
19+
"missing" : "_last"
20+
}
21+
}]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"timeout":"1m","_source":{"includes":["account_number","firstname","address","birthdate","gender","city","lastname","balance","employer","state","age","email","male"],"excludes":[]},"sort":[{"age":{"order":"asc","missing":"_last"}}]}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])
22+
EnumerableCalc(expr#0..12=[{inputs}], expr#13=[20], expr#14=[-($t7, $t13)], proj#0..12=[{exprs}], $f13=[$t14])
23+
CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], LIMIT->50000, SORT->[{
24+
"balance" : {
25+
"order" : "asc",
26+
"missing" : "_last"
27+
}
28+
}]], OpenSearchRequestBuilder(sourceBuilder={"from":0,"size":50000,"timeout":"1m","_source":{"includes":["account_number","firstname","address","birthdate","gender","city","lastname","balance","employer","state","age","email","male"],"excludes":[]},"sort":[{"balance":{"order":"asc","missing":"_last"}}]}, requestedTotalSize=50000, pageSize=null, startFrom=0)])

0 commit comments

Comments
 (0)