CheneyYin commented on code in PR #5919:
URL: https://github.com/apache/seatunnel/pull/5919#discussion_r1405337732
##########
seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonDeserializationSchema.java:
##########
@@ -113,92 +113,97 @@ 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;
- deserialize(jsonNode, out);
- }
-
- public void deserialize(ObjectNode jsonNode, Collector<SeaTunnelRow> out) {
- if (database != null
- &&
!databasePattern.matcher(jsonNode.get(FIELD_DATABASE).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();
- // When a null value is encountered, an exception needs to be thrown
for easy sensing
- if (dataNode == null || dataNode.isNull()) {
- // We'll skip the query or create or alter event data
- if (OP_QUERY.equals(type) || OP_CREATE.equals(type) ||
OP_ALTER.equals(type)) {
+ public void deserialize(ObjectNode jsonNode, Collector<SeaTunnelRow> out)
throws IOException {
+ try {
+ if (database != null
+ &&
!databasePattern.matcher(jsonNode.get(FIELD_DATABASE).asText()).matches()) {
return;
}
- throw new SeaTunnelJsonFormatException(
- CommonErrorCodeDeprecated.JSON_OPERATION_FAILED,
Review Comment:
Thanks for your reminder.
--
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]