baomingyu commented on code in PR #9792:
URL: https://github.com/apache/inlong/pull/9792#discussion_r1517487447
##########
inlong-sort/sort-formats/format-rowdata/format-rowdata-base/src/main/java/org/apache/inlong/sort/formats/base/DefaultDeserializationSchema.java:
##########
@@ -49,13 +52,25 @@ public abstract class DefaultDeserializationSchema<T>
implements Deserialization
*/
private boolean errorOccurred = false;
+ protected FailureHandler failureHandler;
+
/**
* The format metric group.
*/
protected transient FormatMetricGroup formatMetricGroup;
public DefaultDeserializationSchema(boolean ignoreErrors) {
this.ignoreErrors = ignoreErrors;
+ if (ignoreErrors) {
+ failureHandler = new IgnoreFailureHandler();
+ } else {
+ failureHandler = new NoOpFailureHandler();
+ }
+ }
+
+ public DefaultDeserializationSchema(FailureHandler failureHandler) {
+ this.failureHandler = failureHandler;
+ this.ignoreErrors = false;
Review Comment:
done
##########
inlong-sort/sort-formats/format-common/src/main/java/org/apache/inlong/sort/formats/inlongmsg/FailureHandler.java:
##########
@@ -24,6 +24,16 @@
*/
public interface FailureHandler extends Serializable {
+ /**
+ * This method is called when there is a failure occurred while parsing
not InLongMsg.
Review Comment:
done
##########
inlong-sort/sort-formats/format-common/src/main/java/org/apache/inlong/sort/formats/inlongmsg/IgnoreFailureHandler.java:
##########
@@ -27,6 +27,11 @@ public class IgnoreFailureHandler implements FailureHandler {
private static final Logger LOG =
LoggerFactory.getLogger(IgnoreFailureHandler.class);
+ @Override
+ public void onParsingMsgFailure(Object msg, Exception exception) {
+ LOG.error("Could not properly serialize msg=[{}].", msg, exception);
Review Comment:
done
--
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]