[ 
https://issues.apache.org/jira/browse/GOBBLIN-1089?focusedWorklogId=406379&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-406379
 ]

ASF GitHub Bot logged work on GOBBLIN-1089:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Mar/20 16:35
            Start Date: 19/Mar/20 16:35
    Worklog Time Spent: 10m 
      Work Description: sv2000 commented on 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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 406379)
    Time Spent: 0.5h  (was: 20m)

> Refactor RowLevelPolicyChecker for extensibility
> ------------------------------------------------
>
>                 Key: GOBBLIN-1089
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1089
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to