diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java index 0883589f1a5..81beeaef7d0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java @@ -208,8 +208,7 @@ public HashAggBatch(HashAggregate popConfig, RecordBatch incoming, FragmentConte hashAggMemoryManager = new HashAggMemoryManager(configuredBatchSize); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), configuredBatchSize); columnMapping = CaseInsensitiveMap.newHashMap(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java index 56f8f2b3412..58cc31e93f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java @@ -172,8 +172,8 @@ public FlattenRecordBatch(FlattenPOP pop, RecordBatch incoming, FragmentContext int configuredBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); flattenMemoryManager = new FlattenMemoryManager(configuredBatchSize); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), + configuredBatchSize); } @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java index 24fb1d8c3fc..dc063f974f5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatch.java @@ -1261,8 +1261,8 @@ public HashJoinBatch(HashJoinPOP popConfig, FragmentContext context, batchMemoryManager = new JoinBatchMemoryManager(outputBatchSize, left, right, new HashSet<>()); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), + configuredBatchSize); enableRuntimeFilter = context.getOptions().getOption(ExecConstants.HASHJOIN_ENABLE_RUNTIME_FILTER) && popConfig.getRuntimeFilterDef() != null; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/LateralJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/LateralJoinBatch.java index 04a459987a9..d53fb362a22 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/LateralJoinBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/LateralJoinBatch.java @@ -115,6 +115,7 @@ public LateralJoinBatch(LateralJoinPOP popConfig, FragmentContext context, Preconditions.checkNotNull(left); Preconditions.checkNotNull(right); final int configOutputBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), configOutputBatchSize); implicitColumn = popConfig.getImplicitRIDColumn(); populateExcludedField(popConfig); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java index 36320ce2ea6..9f3f1bf0845 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java @@ -138,8 +138,8 @@ protected MergeJoinBatch(MergeJoinPOP popConfig, FragmentContext context, Record final int configuredBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); batchMemoryManager = new MergeJoinMemoryManager(configuredBatchSize, left, right); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), + configuredBatchSize); if (popConfig.getConditions().size() == 0) { throw new UnsupportedOperationException("Merge Join currently does not support cartesian join. This join operator was configured with 0 conditions"); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java index 6b0c7497638..14786a11b38 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java @@ -135,8 +135,8 @@ protected NestedLoopJoinBatch(NestedLoopJoinPOP popConfig, FragmentContext conte int configuredBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); batchMemoryManager = new JoinBatchMemoryManager(configuredBatchSize, left, right, new HashSet<>()); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), + configuredBatchSize); } /** diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectMemoryManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectMemoryManager.java index 81e54db905c..92f2b3d5d97 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectMemoryManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectMemoryManager.java @@ -255,8 +255,8 @@ public void init(RecordBatch incomingBatch, ProjectRecordBatch outgoingBatch) { setOutgoingBatch(outgoingBatch); reset(); - RecordBatchStats.logRecordBatchStats(outgoingBatch.getRecordBatchStatsContext(), - "configuredOutputSize: %d", getOutputBatchSize()); + RecordBatchStats.printConfiguredBatchSize(outgoingBatch.getRecordBatchStatsContext(), + getOutputBatchSize()); } private void reset() { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java index 90656ae4f36..8647468b60f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java @@ -78,8 +78,8 @@ public UnionAllRecordBatch(UnionAll config, List children, Fragment int configuredBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); batchMemoryManager = new RecordBatchMemoryManager(numInputs, configuredBatchSize); - RecordBatchStats.logRecordBatchStats(getRecordBatchStatsContext(), - "configured output batch size: %d", configuredBatchSize); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), + configuredBatchSize); } @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java index 603c58316fe..14447b998a6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestRecordBatch.java @@ -136,6 +136,7 @@ public UnnestRecordBatch(UnnestPOP pop, FragmentContext context) throws OutOfMem pop.addUnnestBatch(this); // get the output batch size from config. int configuredBatchSize = (int) context.getOptions().getOption(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR); + RecordBatchStats.printConfiguredBatchSize(getRecordBatchStatsContext(), configuredBatchSize); memoryManager = new UnnestMemoryManager(configuredBatchSize); rowIdColumnName = pop.getImplicitColumn(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/batchsizing/RecordBatchSizerManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/batchsizing/RecordBatchSizerManager.java index 2e22ce3396a..a39356b6506 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/batchsizing/RecordBatchSizerManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/batchsizing/RecordBatchSizerManager.java @@ -336,8 +336,7 @@ private long normalizeMemorySizePerBatch() { } if (batchStatsContext.isEnableBatchSzLogging()) { - final String message = String.format("The Parquet reader batch memory has been set to [%d] byte(s)", normalizedMemorySize); - RecordBatchStats.logRecordBatchStats(message, batchStatsContext); + RecordBatchStats.printConfiguredBatchSize(batchStatsContext, (int) normalizedMemorySize); } return normalizedMemorySize; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/record/RecordBatchStats.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/record/RecordBatchStats.java index c61607ef5da..e7ea6dd55f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/record/RecordBatchStats.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/record/RecordBatchStats.java @@ -271,6 +271,22 @@ public static String printAllocatorStats(BufferAllocator allocator) { return msg.toString(); } + /** + * Prints the configured batch size + * + * @param batchStatsContext batch stats context object + * @param batchSize contains the configured batch size + */ + public static void printConfiguredBatchSize(RecordBatchStatsContext batchStatsContext, + int batchSize) { + + if (!batchStatsContext.isEnableBatchSzLogging()) { + return; // NOOP + } + final String message = String.format("The batch memory has been set to [%d] byte(s)", batchSize); + logRecordBatchStats(message, batchStatsContext); + } + // ---------------------------------------------------------------------------- // Local Implementation // ---------------------------------------------------------------------------- @@ -371,4 +387,4 @@ private static String toString(RecordBatchIOType ioType) { } -} \ No newline at end of file +}