yihua commented on code in PR #8546:
URL: https://github.com/apache/hudi/pull/8546#discussion_r1770622946


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/clustering/ClusteringCommitSink.java:
##########
@@ -112,11 +112,26 @@ public void open(Configuration parameters) throws 
Exception {
   @Override
   public void invoke(ClusteringCommitEvent event, Context context) throws 
Exception {
     final String instant = event.getInstant();
+    if (event.isFailed()
+        || (event.getWriteStatuses() != null
+        && event.getWriteStatuses().stream().anyMatch(writeStatus -> 
writeStatus.getTotalErrorRecords() > 0))) {
+      LOG.warn("Receive abnormal ClusteringCommitEvent of instant {}, task ID 
is {},"
+              + " is failed: {}, error record count: {}",
+          instant, event.getTaskID(), event.isFailed(), 
getNumErrorRecords(event));
+    }
     commitBuffer.computeIfAbsent(instant, k -> new HashMap<>())
         .put(event.getFileIds(), event);
     commitIfNecessary(instant, commitBuffer.get(instant).values());
   }
 
+  private long getNumErrorRecords(ClusteringCommitEvent event) {
+    if (event.getWriteStatuses() == null) {

Review Comment:
   When `event.isFailed()` is `true`, `event.getWriteStatuses()` can be null, 
causing `NullPointerException`, thus the check.



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