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


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/cdc/kafka/formats/canal/CanalRecordParser.java:
##########
@@ -199,69 +179,67 @@ protected String extractString(String key) {
     }
 
     private boolean isDdl() {
-        return root.get("isDdl") != null && root.get("isDdl").asBoolean();
+        JsonNode isDdlNode = root.get(IS_DDL_FIELD);
+        if (isDdlNode == null) {
+            throw new IllegalArgumentException("Expected 'isDdl' field in the 
JSON but not found.");

Review Comment:
   It is used in ValidateFormat,
   ```java
   if (isDdl()) { // Call the isDdl() method first, and there will be a 
validity of the ddl field
   // Verify the existence of sql fields
   checkNotNull(root.get(FIELD_SQL), errorMessageTemplate, FIELD_SQL);
   } else {
   checkNotNull(root.get(FIELD_MYSQL_TYPE), errorMessageTemplate, 
FIELD_MYSQL_TYPE);
   checkNotNull(root.get(FIELD_PRIMARY_KEYS), errorMessageTemplate, 
FIELD_PRIMARY_KEYS);
   }
   
   private boolean isDdl() {
       JsonNode isDdlNode = root.get(FIELD_IS_DDL);
       if (isDdlNode == null) {
           throw new IllegalArgumentException("Expected 'isDdl' field in the 
JSON but not found.");
       }
       return isDdlNode.asBoolean();
   }
   
   
   ```



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