ilooner commented on a change in pull request #1606: DRILL-6845: Semi-Hash-Join to skip incoming build duplicates, automatically stop skipping if too few URL: https://github.com/apache/drill/pull/1606#discussion_r248151688
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java ########## @@ -959,14 +964,40 @@ public IterOutcome executeBuildPhase() throws SchemaChangeException { numPartitions, RECORDS_PER_BATCH, RECORDS_PER_BATCH, - maxBatchSize, - maxBatchSize, + maxBatchRowCount, + maxBatchRowCount, batchMemoryManager.getOutputBatchSize(), HashTable.DEFAULT_LOAD_FACTOR); if (spilledState.isFirstCycle() && doMemoryCalculation) { // Do auto tuning - buildCalc = partitionNumTuning(maxBatchSize, buildCalc); + buildCalc = partitionNumTuning(maxBatchRowCount, buildCalc); + } + if ( semiSkipDuplicates ) { + // in case of a Semi Join skippinging duplicates, use a "spill control" calc + // (may revert back to the buildCalc if the code decides to stop skipping) + currentCalc = new HashJoinSpillControlImpl(allocator, RECORDS_PER_BATCH, + (int) context.getOptions().getOption(ExecConstants.HASHJOIN_MIN_BATCHES_IN_AVAILABLE_MEMORY_VALIDATOR), + batchMemoryManager, context); + + // calculates the max number of partitions possible + if ( spilledState.isFirstCycle() && doMemoryCalculation ) { + currentCalc.initialize(spilledState.isFirstCycle(), true, // TODO Fix after growing hash values bug fixed + buildBatch, + probeBatch, + buildJoinColumns, + probeSideIsEmpty.booleanValue(), + allocator.getLimit(), + numPartitions, + RECORDS_PER_BATCH, + RECORDS_PER_BATCH, + maxBatchRowCount, + maxBatchRowCount, + batchMemoryManager.getOutputBatchSize(), + HashTable.DEFAULT_LOAD_FACTOR); + + numPartitions = currentCalc.getNumPartitions(); Review comment: Make this the `numPartitions = min(numPartitions, currentCalc.getNumPartitions())` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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