NobiGo commented on code in PR #2657:
URL: https://github.com/apache/calcite/pull/2657#discussion_r785294596


##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchMapping.java:
##########
@@ -150,7 +162,37 @@ private Datatype(final String name) {
       case "float":
         return FACTORY.numberNode(Float.MIN_VALUE);
       case "date":
-        // sentinel for missing dates: 9999-12-31
+        // sentinel for missing dates: 1-1-1
+        final long millisEpoch = LocalDate.of(1, 1, 1)
+            .atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli();
+        // by default elastic returns dates as longs
+        return FACTORY.numberNode(millisEpoch);
+      default:
+        break;
+      }
+
+      // this is unknown type
+      return null;
+    }
+
+    private static @Nullable JsonNode maxMissingValueForType(String name) {
+      switch (name) {
+      case "string": // for ES2
+      case "text":
+      case "keyword":
+        return FACTORY.textNode("~~~~~~~~");

Review Comment:
   How to evaluate the length of the text field. If the value length is less 
than the "~~~~~~~" It maybe can get the right answer. But if the value length 
is longer than this? 



-- 
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]

Reply via email to