zhilinli123 commented on code in PR #4195:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4195#discussion_r1115326218


##########
seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonDeserializationSchema.java:
##########
@@ -109,24 +109,23 @@ public SeaTunnelDataType<SeaTunnelRow> getProducedType() {
         return this.physicalRowType;
     }
 
+    @Override
     public void deserialize(byte[] message, Collector<SeaTunnelRow> out) {
         if (message == null) {
             return;
         }
         ObjectNode jsonNode = (ObjectNode) convertBytes(message);
         assert jsonNode != null;
-        if (database != null) {
-            if 
(!databasePattern.matcher(jsonNode.get(FIELD_DATABASE).asText()).matches()) {
-                return;
-            }
+        if (database != null
+                && 
!databasePattern.matcher(jsonNode.get(FIELD_DATABASE).asText()).matches()) {
+            return;
         }
-        if (table != null) {
-            if 
(!tablePattern.matcher(jsonNode.get(FIELD_TABLE).asText()).matches()) {
-                return;
-            }
+        if (table != null && 
!tablePattern.matcher(jsonNode.get(FIELD_TABLE).asText()).matches()) {
+            return;
         }
         JsonNode dataNode = jsonNode.get(FIELD_DATA);
         String type = jsonNode.get(FIELD_TYPE).asText();
+        assert dataNode != null;

Review Comment:
   > 是否可以抛出业务异常?
   
   
   
   > 是否可以抛出业务异常?
   Like this?
   if (dataNode == null) {
               new NullPointerException("deserialize cancal-json ‘data’ is 
null" + jsonNode)
           } 



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