NobiGo commented on a change in pull request #2657:
URL: https://github.com/apache/calcite/pull/2657#discussion_r785239542
##########
File path:
elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java
##########
@@ -746,4 +759,40 @@ public static void setupInstance() throws Exception {
"state=AR; EXPR$1=3; EXPR$2=3");
}
+ @Test void testNullsSort() {
+ calciteAssertZipsWithNull()
+ .query("select id, pop from zipswithnull order by pop desc nulls last")
+ .returns("id=01701; pop=65046\n"
+ + "id=02401; pop=59498\n"
+ + "id=02154; pop=57871\n"
+ + "id=null; pop=47687\n"
+ + "id=null; pop=45442\n"
+ + "id=null; pop=null\n")
+ .queryContains(
+ ElasticsearchChecker.elasticsearchChecker(
+ "_source:[ 'id', 'pop' ]",
+ "sort:[ {pop:{missing:'_last', order:'desc'}} ]",
+ "size:5196"));
+
+ calciteAssertZipsWithNull()
+ .query("select pop, count(1) as CNT from zipswithnull group by pop "
Review comment:
Please use line breaking
```
\n
```
to reformat the query.
##########
File path:
elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/AggregationTest.java
##########
@@ -401,6 +401,34 @@ public static void setupInstance() throws Exception {
"aggregations:{'v1.max.field': 'val1'",
"'v2.min.field': 'val2'}"))
.returnsUnordered("v1=7; v2=5");
+ }
+
+ @Test void testMultiNullsSortInGroup() {
+ CalciteAssert.that()
+ .with(newConnectionFactory())
Review comment:
According the query and result, Actually I can't judge the result is
wrong or right. So please make the test data more clearly for your test.
##########
File path:
elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java
##########
@@ -746,4 +759,40 @@ public static void setupInstance() throws Exception {
"state=AR; EXPR$1=3; EXPR$2=3");
}
+ @Test void testNullsSort() {
+ calciteAssertZipsWithNull()
+ .query("select id, pop from zipswithnull order by pop desc nulls last")
+ .returns("id=01701; pop=65046\n"
+ + "id=02401; pop=59498\n"
+ + "id=02154; pop=57871\n"
+ + "id=null; pop=47687\n"
+ + "id=null; pop=45442\n"
+ + "id=null; pop=null\n")
+ .queryContains(
+ ElasticsearchChecker.elasticsearchChecker(
+ "_source:[ 'id', 'pop' ]",
+ "sort:[ {pop:{missing:'_last', order:'desc'}} ]",
+ "size:5196"));
+
+ calciteAssertZipsWithNull()
+ .query("select pop, count(1) as CNT from zipswithnull group by pop "
+ + "order by pop asc nulls last")
+ .returns("pop=45442; CNT=1\n"
+ + "pop=47687; CNT=1\n"
+ + "pop=57871; CNT=1\n"
+ + "pop=59498; CNT=1\n"
+ + "pop=65046; CNT=1\n"
+ + "pop=null; CNT=1\n");
Review comment:
Please add elasticsearch script check in this unit test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]