You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "fuweng11 (via GitHub)" <gi...@apache.org> on 2023/04/23 08:45:12 UTC

[GitHub] [inlong] fuweng11 commented on a diff in pull request #7894: [INLONG-7893][Manager] Support field description when parsing field by JSON

fuweng11 commented on code in PR #7894:
URL: https://github.com/apache/inlong/pull/7894#discussion_r1174537279


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/StreamSinkServiceImpl.java:
##########
@@ -791,11 +794,19 @@ private Map<String, String> parseFieldsBySql(String sql) throws JSQLParserExcept
         return fields;
     }
 
-    private Map<String, String> parseFieldsByJson(String statement) throws JsonProcessingException {
-        // Use LinkedHashMap deserialization to keep the order of the fields
-        return objectMapper.readValue(statement,
-                new TypeReference<LinkedHashMap<String, String>>() {
-                });
+    private List<SinkField> parseFieldsByJson(String statement) throws JsonProcessingException {
+        return objectMapper.readValue(statement, new TypeReference<List<Map<String, String>>>() {
+        }).stream().map(line -> {
+            String name = line.get(STREAM_FILED_JSON_NAME_PROP);
+            String type = line.get(STREAM_FILED_JSON_TYPE_PROP);
+            String desc = line.get(STREAM_FILED_JSON_COMMENT_PROP);
+            Map.Entry<String, String> next = line.entrySet().iterator().next();
+            SinkField streamField = new SinkField();

Review Comment:
   `streamField`  -> `sinkField`



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org