asereda-gs commented on a change in pull request #2657:
URL: https://github.com/apache/calcite/pull/2657#discussion_r785271744
##########
File path:
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchMapping.java
##########
@@ -102,19 +105,28 @@ String index() {
private static final JsonNodeFactory FACTORY = JsonNodeFactory.instance;
// pre-cache missing values
- private static final Set<JsonNode> MISSING_VALUES =
+ private static final Set<JsonNode> MIN_MISSING_VALUES =
Stream.of("string", // for ES2
"text", "keyword",
"date", "long", "integer", "double", "float")
- .map(Datatype::missingValueForType)
+ .map(Datatype::minMissingValueForType)
+ .collect(Collectors.toSet());
+
+ private static final Set<JsonNode> MAX_MISSING_VALUES =
Review comment:
Do I understand correctly that you need MIN/MAX missing value because
you'll be also sorting by aggregate term ?
### Example
```sql
-- term can be absent so requires missing value bucket in ES
select term, count(*) from foo order by term desc
```
##########
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:
I think there are too many unnecessary changes in
`ElasticSearchAdapterTest`. You can reuse `AggregationTest` or create your own
class (eg. `SortTest`). I assume you would want to test both aggregation and
sorting in the same query.
--
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]