DongLiang-0 commented on code in PR #272:
URL: 
https://github.com/apache/doris-flink-connector/pull/272#discussion_r1427497219


##########
flink-doris-connector/src/main/java/org/apache/doris/flink/deserialization/DorisJsonDebeziumDeserializationSchema.java:
##########
@@ -111,65 +116,74 @@ private JsonNode convertToJson(Schema schema, Object 
value) throws DorisExceptio
                     } else if (value instanceof BigDecimal) {
                         return JSON_NODE_FACTORY.numberNode((BigDecimal) 
value);
                     } else {
-                        throw new DorisException("Invalid type for bytes type: 
" + value.getClass());
+                        throw new DorisException(
+                                "Invalid type for bytes type: " + 
value.getClass());
                     }
-                case ARRAY: {
-                    Collection<?> collection = (Collection<?>) value;
-                    ArrayNode list = JSON_NODE_FACTORY.arrayNode();
-                    for (Object elem : collection) {
-                        Schema valueSchema = schema == null ? null : 
schema.valueSchema();
-                        JsonNode fieldValue = convertToJson(valueSchema, elem);
-                        list.add(fieldValue);
+                case ARRAY:
+                    {
+                        Collection<?> collection = (Collection<?>) value;
+                        ArrayNode list = JSON_NODE_FACTORY.arrayNode();
+                        for (Object elem : collection) {
+                            Schema valueSchema = schema == null ? null : 
schema.valueSchema();
+                            JsonNode fieldValue = convertToJson(valueSchema, 
elem);
+                            list.add(fieldValue);
+                        }
+                        return list;
                     }
-                    return list;
-                }
-                case MAP: {
-                    Map<?, ?> map = (Map<?, ?>) value;
-                    // If true, using string keys and JSON object; if false, 
using non-string keys and Array-encoding
-                    boolean objectMode;
-                    if (schema == null) {
-                        objectMode = true;
-                        for (Map.Entry<?, ?> entry : map.entrySet()) {
-                            if (!(entry.getKey() instanceof String)) {
-                                objectMode = false;
-                                break;
+                case MAP:
+                    {
+                        Map<?, ?> map = (Map<?, ?>) value;
+                        // If true, using string keys and JSON object; if 
false, using non-string
+                        // keys and Array-encoding
+                        boolean objectMode;
+                        if (schema == null) {
+                            objectMode = true;
+                            for (Map.Entry<?, ?> entry : map.entrySet()) {
+                                if (!(entry.getKey() instanceof String)) {
+                                    objectMode = false;
+                                    break;
+                                }
                             }
+                        } else {
+                            objectMode = schema.keySchema().type() == 
Schema.Type.STRING;
                         }
-                    } else {
-                        objectMode = schema.keySchema().type() == 
Schema.Type.STRING;
-                    }
-                    ObjectNode obj = null;
-                    ArrayNode list = null;
-                    if (objectMode) {
-                        obj = JSON_NODE_FACTORY.objectNode();
-                    } else {
-                        list = JSON_NODE_FACTORY.arrayNode();
-                    }
-                    for (Map.Entry<?, ?> entry : map.entrySet()) {
-                        Schema keySchema = schema == null ? null : 
schema.keySchema();
-                        Schema valueSchema = schema == null ? null : 
schema.valueSchema();
-                        JsonNode mapKey = convertToJson(keySchema, 
entry.getKey());
-                        JsonNode mapValue = convertToJson(valueSchema, 
entry.getValue());
-
+                        ObjectNode obj = null;
+                        ArrayNode list = null;
                         if (objectMode) {
-                            obj.set(mapKey.asText(), mapValue);
+                            obj = JSON_NODE_FACTORY.objectNode();

Review Comment:
   Due to code formatting reasons, the actual line 153 corresponds to line 164.



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