lvyanquan commented on code in PR #4227:
URL: https://github.com/apache/flink-cdc/pull/4227#discussion_r2703024015


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -1096,4 +1098,37 @@ public static boolean lessThanOrEqual(Object lhs, Object 
rhs) {
         }
         return universalCompares(lhs, rhs) <= 0;
     }
+
+    public static Variant tryParseJson(String jsonStr) {
+        return tryParseJson(jsonStr, false);
+    }
+
+    public static Variant tryParseJson(String jsonStr, boolean 
allowDuplicateKeys) {
+        if (jsonStr == null || jsonStr.isEmpty()) {
+            return null;
+        }
+
+        try {
+            return BinaryVariantInternalBuilder.parseJson(jsonStr, 
allowDuplicateKeys);
+        } catch (Throwable e) {
+            return null;
+        }
+    }
+
+    public static Variant parseJson(String jsonStr) {
+        return parseJson(jsonStr, false);
+    }
+
+    public static Variant parseJson(String jsonStr, boolean 
allowDuplicateKeys) {
+        if (jsonStr == null || jsonStr.isEmpty()) {
+            return null;

Review Comment:
   Return null to be consistent with FlinkSQL, refer to:
   
https://github.com/apache/flink/blob/61f9ffece974134c8d7da8f87e3092b54af9a700/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/scalar/ParseJsonFunction.java#L42



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