NobiGo commented on a change in pull request #2657:
URL: https://github.com/apache/calcite/pull/2657#discussion_r774250555
##########
File path:
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSort.java
##########
@@ -62,6 +62,8 @@
for (RelFieldCollation fieldCollation : collation.getFieldCollations()) {
final String name = fields.get(fieldCollation.getFieldIndex()).getName();
final String rawName = implementor.expressionItemMap.getOrDefault(name,
name);
+ // if nulls order is not specified, default NULLS LAST/FIRST for ASC/DESC
+ implementor.addNullsSort(rawName, fieldCollation.nullDirection);
Review comment:
The default behavior is stay same as ES ? Assording
[_missing_values](https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html#_missing_values)
The default behavior is always _LAST.
##########
File path:
elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/AggregationTest.java
##########
@@ -400,6 +400,21 @@ public static void setupInstance() throws Exception {
"aggregations:{'v1.max.field': 'val1'",
"'v2.min.field': 'val2'}"))
.returnsUnordered("v1=7; v2=5");
+ }
+
+ @Test void testNullsSort() {
Review comment:
Can we remove this tests out the AggregationTest ? This unit test isn't
belong to the type.
--
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]