You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/03/19 16:35:50 UTC

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2930: [GOBBLIN-1089] Refactor policyChecker for extensibility

sv2000 commented on a change in pull request #2930: [GOBBLIN-1089] Refactor policyChecker for extensibility
URL: https://github.com/apache/incubator-gobblin/pull/2930#discussion_r395161522
 
 

 ##########
 File path: gobblin-core/src/main/java/org/apache/gobblin/qualitychecker/row/RowLevelPolicyChecker.java
 ##########
 @@ -102,25 +102,35 @@ public boolean executePolicies(Object record, RowLevelPolicyCheckResults results
     for (RowLevelPolicy p : this.list) {
       RowLevelPolicy.Result result = p.executePolicy(record);
       results.put(p, result);
+      if (!handleCheckResult(result, p, record)) {
+        return false;
+      }
+    }
+    return true;
+  }
 
-      if (result.equals(RowLevelPolicy.Result.FAILED)) {
-        if (p.getType().equals(RowLevelPolicy.Type.FAIL)) {
-          throw new RuntimeException("RowLevelPolicy " + p + " failed on record " + record);
-        } else if (p.getType().equals(RowLevelPolicy.Type.ERR_FILE)) {
-          if (this.sampler.acceptNext()) {
-            if (!this.errFileOpen) {
-              this.writer.open(getErrFilePath(p));
-              this.writer.write(record);
-            } else {
-              this.writer.write(record);
-            }
-            this.errFileOpen = true;
+  /**
+   * Handle the result of {@link RowLevelPolicy#executePolicy(Object)}
+   */
+  protected boolean handleCheckResult(RowLevelPolicy.Result checkResult, RowLevelPolicy p, Object record) throws IOException {
 
 Review comment:
   handleCheckResult -> checkResult?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services