Hisoka-X commented on code in PR #7836:
URL: https://github.com/apache/seatunnel/pull/7836#discussion_r1799526739
##########
seatunnel-formats/seatunnel-format-compatible-debezium-json/src/main/java/org/apache/seatunnel/format/compatible/debezium/json/CompatibleDebeziumJsonSerializationSchema.java:
##########
@@ -30,15 +30,20 @@
@RequiredArgsConstructor
public class CompatibleDebeziumJsonSerializationSchema implements
SerializationSchema {
+ private final boolean isKey;
private final int index;
public CompatibleDebeziumJsonSerializationSchema(SeaTunnelRowType rowType,
boolean isKey) {
+ this.isKey = isKey;
this.index = rowType.indexOf(isKey ? FIELD_KEY : FIELD_VALUE);
}
@Override
public byte[] serialize(SeaTunnelRow row) {
String field = (String) row.getField(index);
+ if (isKey && field == null) {
+ return null;
+ }
Review Comment:
how about this? Because if we not return null, the NPE will be throwed.
```suggestion
if (field == null) {
return null;
}
```
--
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]