Skip to content

Commit 5ab39f9

Browse files
author
Selina Song
committed
Add sort double reverse no op test
Signed-off-by: Selina Song <[email protected]>
1 parent a5b3df8 commit 5ab39f9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ public void testExplainWithTimechartCount() throws IOException {
252252
assertJsonEqualsIgnoreId(expected, result);
253253
}
254254

255+
@Test
256+
public void testDoubleReverseWithSortNoOp() throws IOException {
257+
String query =
258+
"source=opensearch-sql_test_index_account | sort - age, + firstname | reverse | reverse";
259+
var result = explainQueryToString(query);
260+
String expected = loadFromFile("expectedOutput/calcite/explain_double_reverse_sort_no_op.json");
261+
assertJsonEqualsIgnoreId(expected, result);
262+
}
263+
255264
@Test
256265
public void noPushDownForAggOnWindow() throws IOException {
257266
Assume.assumeTrue("This test is only for push down enabled", isPushdownEnabled());
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"calcite": {
3+
"logical": "LogicalSystemLimit(sort0=[$8], sort1=[$1], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(account_number=[$0], firstname=[$1], address=[$2], balance=[$3], gender=[$4], city=[$5], employer=[$6], state=[$7], age=[$8], email=[$9], lastname=[$10])\n LogicalSort(sort0=[$8], sort1=[$1], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first])\n CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_account]])\n",
4+
"physical": "CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_account]], PushDownContext=[[PROJECT->[account_number, firstname, address, balance, gender, city, employer, state, age, email, lastname], SORT->[{\n \"age\" : {\n \"order\" : \"desc\",\n \"missing\" : \"_last\"\n }\n}, {\n \"firstname.keyword\" : {\n \"order\" : \"asc\",\n \"missing\" : \"_first\"\n }\n}], LIMIT->10000], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"_source\":{\"includes\":[\"account_number\",\"firstname\",\"address\",\"balance\",\"gender\",\"city\",\"employer\",\"state\",\"age\",\"email\",\"lastname\"],\"excludes\":[]},\"sort\":[{\"age\":{\"order\":\"desc\",\"missing\":\"_last\"}},{\"firstname.keyword\":{\"order\":\"asc\",\"missing\":\"_first\"}}]}, requestedTotalSize=10000, pageSize=null, startFrom=0)])\n"
5+
}
6+
}

0 commit comments

Comments
 (0)