ihuzenko commented on a change in pull request #1981: DRILL-7583: Remove STOP 
status from operator outcome
URL: https://github.com/apache/drill/pull/1981#discussion_r379437279
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java
 ##########
 @@ -479,34 +493,41 @@ private IterOutcome sniffNonEmptyBatch(IterOutcome curr, 
int inputIndex, RecordB
       curr = next(inputIndex, recordBatch);
 
       switch (curr) {
-        case OK:
-          // We got a data batch
-          break;
-        case NOT_YET:
-          // We need to try again
-          break;
-        case EMIT:
-          throw new UnsupportedOperationException("We do not support " + EMIT);
-        default:
-          // Other cases are termination conditions
-          return curr;
+      case OK:
+        // We got a data batch
+        break;
+      case NOT_YET:
+        // We need to try again
+        break;
+      case EMIT:
+        throw new UnsupportedOperationException("We do not support " + EMIT);
+      default:
+        // Other cases are termination conditions
+        return curr;
       }
     }
   }
 
   /**
-   * Determines the memory calculator to use. If maxNumBatches is configured 
simple batch counting is used to spill. Otherwise
-   * memory calculations are used to determine when to spill.
+   * Determines the memory calculator to use. If maxNumBatches is configured
+   * simple batch counting is used to spill. Otherwise memory calculations are
+   * used to determine when to spill.
+   *
    * @return The memory calculator to use.
    */
   public HashJoinMemoryCalculator getCalculatorImpl() {
     if (maxBatchesInMemory == 0) {
-      double safetyFactor = 
context.getOptions().getDouble(ExecConstants.HASHJOIN_SAFETY_FACTOR_KEY);
-      double fragmentationFactor = 
context.getOptions().getDouble(ExecConstants.HASHJOIN_FRAGMENTATION_FACTOR_KEY);
-      double hashTableDoublingFactor = 
context.getOptions().getDouble(ExecConstants.HASHJOIN_HASH_DOUBLE_FACTOR_KEY);
-      String hashTableCalculatorType = 
context.getOptions().getString(ExecConstants.HASHJOIN_HASHTABLE_CALC_TYPE_KEY);
-
-      return new HashJoinMemoryCalculatorImpl(safetyFactor, 
fragmentationFactor, hashTableDoublingFactor, hashTableCalculatorType, 
semiJoin);
+      double safetyFactor = context.getOptions()
+          .getDouble(ExecConstants.HASHJOIN_SAFETY_FACTOR_KEY);
+      double fragmentationFactor = context.getOptions()
+          .getDouble(ExecConstants.HASHJOIN_FRAGMENTATION_FACTOR_KEY);
+      double hashTableDoublingFactor = context.getOptions()
+          .getDouble(ExecConstants.HASHJOIN_HASH_DOUBLE_FACTOR_KEY);
+      String hashTableCalculatorType = context.getOptions()
+          .getString(ExecConstants.HASHJOIN_HASHTABLE_CALC_TYPE_KEY);
+
+      return new HashJoinMemoryCalculatorImpl(safetyFactor, 
fragmentationFactor,
+          hashTableDoublingFactor, hashTableCalculatorType, semiJoin);
 
 Review comment:
   In order to shorten the method could be rewritten to : 
   
   ```java
     public HashJoinMemoryCalculator getCalculatorImpl() {
       if (maxBatchesInMemory != 0) {
         return new HashJoinMechanicalMemoryCalculator(maxBatchesInMemory);
       }
       OptionManager opts = context.getOptions();
       double safety = opts.getDouble(ExecConstants.HASHJOIN_SAFETY_FACTOR_KEY);
       double fragmentation = 
opts.getDouble(ExecConstants.HASHJOIN_FRAGMENTATION_FACTOR_KEY);
       double hashTableDoubling = 
opts.getDouble(ExecConstants.HASHJOIN_HASH_DOUBLE_FACTOR_KEY);
       String hashTableCalcType = 
opts.getString(ExecConstants.HASHJOIN_HASHTABLE_CALC_TYPE_KEY);
       return new HashJoinMemoryCalculatorImpl(safety, fragmentation, 
hashTableDoubling, hashTableCalcType, semiJoin);
     }
   ``` 

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


With regards,
Apache Git Services

Reply via email to