MonsterChenzhuo commented on code in PR #1880:
URL: https://github.com/apache/incubator-paimon/pull/1880#discussion_r1304241678


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/cdc/kafka/formats/canal/CanalRecordParser.java:
##########
@@ -273,4 +251,99 @@ private Map<String, String> extractRow(
 
         return resultMap;
     }
+
+    private String transformValue(String oldValue, String mySqlType) {
+        String newValue = oldValue;
+        String shortType = MySqlTypeUtils.getShortType(mySqlType);
+
+        if (MySqlTypeUtils.isSetType(shortType)) {
+            newValue = CanalFieldParser.convertSet(newValue, mySqlType);
+        } else if (MySqlTypeUtils.isEnumType(shortType)) {
+            newValue = CanalFieldParser.convertEnum(newValue, mySqlType);
+        } else if (MySqlTypeUtils.isGeoType(shortType)) {
+            try {
+                byte[] wkb =
+                        CanalFieldParser.convertGeoType2WkbArray(
+                                oldValue.getBytes(CHARSET_ISO_8859_1));
+                newValue = MySqlTypeUtils.convertWkbArray(wkb);
+            } catch (Exception e) {
+                throw new IllegalArgumentException(
+                        String.format("Failed to convert %s to geometry 
JSON.", oldValue), e);
+            }
+        }
+        return newValue;
+    }

Review Comment:
   done.



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