ZihanLi58 commented on a change in pull request #2819: [GOBBLIN-971]Enable 
speculative execution awareness for RowQualityChecker
URL: https://github.com/apache/incubator-gobblin/pull/2819#discussion_r348238904
 
 

 ##########
 File path: 
gobblin-core/src/main/java/org/apache/gobblin/qualitychecker/row/RowLevelPolicyChecker.java
 ##########
 @@ -45,7 +46,17 @@
 import lombok.Getter;
 
 
-public class RowLevelPolicyChecker<S, D> implements Closeable, FinalState, 
RecordStreamProcessor<S, S, D, D> {
+public class RowLevelPolicyChecker<S, D> implements Closeable, FinalState, 
RecordStreamProcessor<S, S, D, D>,
+                                                    
SpeculativeAttemptAwareConstruct {
+
+  /**
+   * Given the existence of writer object when the policy is set to {@link 
RowLevelPolicy.Type#ERR_FILE}, objects of
+   * this class needs to be speculative-attempt-aware.
+   */
+  @Override
+  public boolean isSpeculativeAttemptSafe() {
+    return !this.list.stream().allMatch(x -> 
x.getType().equals(RowLevelPolicy.Type.ERR_FILE)) || 
this.allowSpeculativeExecWhenWriteErrFile;
 
 Review comment:
   Why this one is allMatch? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to