EMsnap commented on code in PR #6688:
URL: https://github.com/apache/inlong/pull/6688#discussion_r1035862494


##########
inlong-sort/sort-connectors/kafka/src/main/java/org/apache/inlong/sort/kafka/table/DynamicKafkaDeserializationSchema.java:
##########
@@ -149,6 +171,35 @@ public void deserialize(ConsumerRecord<byte[], byte[]> 
record, Collector<RowData
         keyCollector.buffer.clear();
     }
 
+    private void deserializeWithDirtyHandle(byte[] value, DirtyType dirtyType,
+            DeserializationSchema<RowData> deserialization, Collector<RowData> 
collector) throws IOException {
+        if (!dirtyOptions.ignoreDirty()) {
+            deserialization.deserialize(value, collector);
+        } else {
+            try {
+                deserialization.deserialize(value, collector);
+            } catch (IOException e) {
+                LOG.warn("deserialize error", e);
+                if (dirtySink != null) {
+                    DirtyData.Builder<String> builder = DirtyData.builder();
+                    try {
+                        builder.setData(new String(value))
+                                .setDirtyType(dirtyType)
+                                .setLabels(dirtyOptions.getLabels())
+                                .setLogTag(dirtyOptions.getLogTag())
+                                .setIdentifier(dirtyOptions.getIdentifier());
+                        dirtySink.invoke(builder.build());
+                    } catch (Exception ex) {
+                        if (!dirtyOptions.ignoreSideOutputErrors()) {
+                            throw new IOException(ex);
+                        }
+                        LOG.warn("Dirty sink failed", ex);

Review Comment:
   suggested to error log and print the dirty data 



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to