SaintBacchus commented on code in PR #16806:
URL: https://github.com/apache/doris/pull/16806#discussion_r1111401946


##########
fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java:
##########
@@ -254,14 +267,38 @@ public static QueryBuilder toEsDsl(Expr expr, List<Expr> 
notPushDownList, Map<St
             }
         }
         if (expr instanceof InPredicate) {
-            return parseInPredicate(expr, column);
+            return parseInPredicate(expr, column, builderOptions);
         }
         if (expr instanceof FunctionCallExpr) {
             return parseFunctionCallExpr(expr);
         }
         return null;
     }
 
+    private static final DateTimeFormatter dorisFmt = 
DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
+    private static final DateTimeFormatter esFmt = 
ISODateTimeFormat.dateTime();
+
+    private static void setNeedCompatDate(String column, BuilderOptions 
builderOptions) {
+        Map<String, ObjectNode> originFields = 
builderOptions.getOriginFields();
+        if (originFields != null && originFields.containsKey(column)) {
+            ObjectNode jsonNodes = originFields.get(column);
+            // Compat use default format date type, need transform datetime to
+            if (jsonNodes.has("type") && !jsonNodes.has("format")) {
+                String type = jsonNodes.get("type").asText();
+                if ("date".equals(type)) {
+                    builderOptions.setNeedCompatDate(true);
+                }
+            }
+        }
+    }
+
+    private static Object compatDefaultDate(Object value) {
+        if (value == null) {
+            return null;
+        }
+        return dorisFmt.parseDateTime(value.toString()).toString(esFmt);

Review Comment:
   The es table(not the external table) will use the isodatetime?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to