Skip to content

Commit 0f676bf

Browse files
committed
update IT
Signed-off-by: xinyual <xinyual@amazon.com>
1 parent 8720c74 commit 0f676bf

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
package org.opensearch.sql.calcite.remote;
77

8+
import static org.opensearch.sql.util.MatcherUtils.assertJsonEqualsIgnoreId;
9+
810
import java.io.IOException;
911
import org.junit.Ignore;
12+
import org.junit.jupiter.api.Test;
1013
import org.opensearch.sql.ppl.ExplainIT;
1114

1215
public class CalciteExplainIT extends ExplainIT {
@@ -20,4 +23,20 @@ public void init() throws Exception {
2023
@Override
2124
@Ignore("test only in v2")
2225
public void testExplainModeUnsupportedInV2() throws IOException {}
26+
27+
@Test
28+
public void testFilterByCompareStringTimestampPushDownExplain() throws IOException {
29+
String expected =
30+
isCalciteEnabled()
31+
? loadFromFile(
32+
"expectedOutput/calcite/explain_filter_push_compare_timestamp_string.json")
33+
: loadFromFile("expectedOutput/ppl/explain_filter_push_compare_timestamp_string.json");
34+
35+
assertJsonEqualsIgnoreId(
36+
expected,
37+
explainQueryToString(
38+
"source=opensearch-sql_test_index_bank"
39+
+ "| where birthdate > '2016-12-08 00:00:00.000000000' "
40+
+ "| where birthdate < '2018-11-09 00:00:00.000000000' "));
41+
}
2342
}

integ-test/src/test/java/org/opensearch/sql/ppl/ExplainIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public void testFilterByCompareStringTimestampPushDownExplain() throws IOExcepti
7070
expected,
7171
explainQueryToString(
7272
"source=opensearch-sql_test_index_bank"
73-
+ "| where birthdate > '2016-12-08 00:00:00' "
74-
+ "| where birthdate < '2018-11-09 00:00:00' "));
73+
+ "| where birthdate > '2016-12-08 00:00:00.000000000' "
74+
+ "| where birthdate < '2018-11-09 00:00:00.000000000' "));
7575
}
7676

7777
@Test
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"calcite" : {
3-
"logical" : "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])\n LogicalFilter(condition=[<($3, TIMESTAMP('2018-11-09 00:00:00':VARCHAR))])\n LogicalFilter(condition=[>($3, TIMESTAMP('2016-12-08 00:00:00':VARCHAR))])\n CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])\n",
3+
"logical" : "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])\n LogicalFilter(condition=[<($3, TIMESTAMP('2018-11-09 00:00:00.000000000':VARCHAR))])\n LogicalFilter(condition=[>($3, TIMESTAMP('2016-12-08 00:00:00.000000000':VARCHAR))])\n CalciteLogicalIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]])\n",
44
"physical" : "CalciteEnumerableIndexScan(table=[[OpenSearch, opensearch-sql_test_index_bank]], PushDownContext=[[PROJECT->[account_number, firstname, address, birthdate, gender, city, lastname, balance, employer, state, age, email, male], FILTER->>($3, '2016-12-08 00:00:00'), FILTER-><($3, '2018-11-09 00:00:00')], OpenSearchRequestBuilder(sourceBuilder={\"from\":0,\"timeout\":\"1m\",\"query\":{\"bool\":{\"filter\":[{\"range\":{\"birthdate\":{\"from\":\"2016-12-08T00:00:00.000Z\",\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},{\"range\":{\"birthdate\":{\"from\":null,\"to\":\"2018-11-09T00:00:00.000Z\",\"include_lower\":true,\"include_upper\":false,\"boost\":1.0}}}],\"adjust_pure_negative\":true,\"boost\":1.0}},\"_source\":{\"includes\":[\"account_number\",\"firstname\",\"address\",\"birthdate\",\"gender\",\"city\",\"lastname\",\"balance\",\"employer\",\"state\",\"age\",\"email\",\"male\"],\"excludes\":[]},\"sort\":[{\"_doc\":{\"order\":\"asc\"}}]}, requestedTotalSize=2147483647, pageSize=null, startFrom=0)])\n"
55
}
66
}

0 commit comments

Comments
 (0)