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/04/16 19:11:30 UTC

[GitHub] [incubator-gobblin] zxcware commented on a change in pull request #2957: [GOBBLIN-1117]Enable record count verification for ORC format

zxcware commented on a change in pull request #2957: [GOBBLIN-1117]Enable record count verification for ORC format
URL: https://github.com/apache/incubator-gobblin/pull/2957#discussion_r409785019
 
 

 ##########
 File path: gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionThresholdVerifier.java
 ##########
 @@ -62,34 +62,41 @@ public CompactionThresholdVerifier(State state) {
    *
    * @return true iff the difference exceeds the threshold or this is the first time compaction
    */
-  public Result verify (FileSystemDataset dataset) {
+  public Result verify(FileSystemDataset dataset) {
 
     Map<String, Double> thresholdMap = RecompactionConditionBasedOnRatio.
-            getDatasetRegexAndRecompactThreshold (state.getProp(MRCompactor.COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET,
-                    StringUtils.EMPTY));
+        getDatasetRegexAndRecompactThreshold(
+            state.getProp(MRCompactor.COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET, StringUtils.EMPTY));
 
     CompactionPathParser.CompactionParserResult result = new CompactionPathParser(state).parse(dataset);
 
-    double threshold = RecompactionConditionBasedOnRatio.getRatioThresholdByDatasetName(result.getDatasetName(), thresholdMap);
-    log.debug ("Threshold is {} for dataset {}", threshold, result.getDatasetName());
+    double threshold =
+        RecompactionConditionBasedOnRatio.getRatioThresholdByDatasetName(result.getDatasetName(), thresholdMap);
+    log.debug("Threshold is {} for dataset {}", threshold, result.getDatasetName());
 
     InputRecordCountHelper helper = new InputRecordCountHelper(state);
     try {
       double newRecords = 0;
       if (!dataset.isVirtual()) {
-        newRecords = helper.calculateRecordCount (Lists.newArrayList(new Path(dataset.datasetURN())));
+        newRecords = helper.calculateRecordCount(Lists.newArrayList(new Path(dataset.datasetURN())));
       }
-      double oldRecords = helper.readRecordCount (new Path(result.getDstAbsoluteDir()));
+      double oldRecords = helper.readRecordCount(new Path(result.getDstAbsoluteDir()));
 
       if (oldRecords == 0) {
         return new Result(true, "");
       }
       if ((newRecords - oldRecords) / oldRecords > threshold) {
-        log.debug ("Dataset {} records exceeded the threshold {}", dataset.datasetURN(), threshold);
+        if (newRecords < oldRecords) {
 
 Review comment:
   put outside? otherwise, `(newRecords - oldRecords) / oldRecords` is a negative value and will be always smaller than a positive threshold.

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