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


##########
fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java:
##########
@@ -215,20 +184,29 @@ public static List<Column> genColumnsFromEs(EsRestClient 
client, String indexNam
             column.setUniqueId(-1);
             columns.add(column);
         }
-        for (String key : keys) {
-            JSONObject field = (JSONObject) mappingProps.get(key);
-            Type type;
-            // Complex types are treating as String types for now.
-            if (field.containsKey("type")) {
-                type = toDorisType(field.get("type").toString());
-            } else {
-                type = Type.STRING;
-            }
+        Iterator<String> iterator = mappingProps.fieldNames();
+        while (iterator.hasNext()) {
+            String key = iterator.next();
             Column column = new Column();
             column.setName(key);
             column.setIsKey(true);
             column.setIsAllowNull(true);
             column.setUniqueId(-1);
+            ObjectNode field = (ObjectNode) mappingProps.get(key);
+            Type type;
+            // Complex types are treating as String types for now.
+            if (field.has("type")) {
+                String typeStr = field.get("type").asText();
+                if ("date".equals(typeStr)) {
+                    type = parseEsDateType(column, field);
+                } else {
+                    type = toDorisType(typeStr);

Review Comment:
   fill all these codes into the function `toDorisType`? I think toDorisType is 
only used here



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