Skip to content

Commit

Permalink
DRILL-6560: Enhanced the batch statistics logging enablement
Browse files Browse the repository at this point in the history
closes #1355
  • Loading branch information
sachouche authored and sohami committed Jul 12, 2018
1 parent cfe61eb commit 80fb761
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 107 deletions.
Expand Up @@ -711,5 +711,8 @@ public static String bootDefaultFor(String name) {
public static final String STATS_LOGGING_FG_BATCH_SIZE_OPTION = "drill.exec.stats.logging.fine_grained.batch_size"; public static final String STATS_LOGGING_FG_BATCH_SIZE_OPTION = "drill.exec.stats.logging.fine_grained.batch_size";
public static final BooleanValidator STATS_LOGGING_BATCH_FG_SIZE_VALIDATOR = new BooleanValidator(STATS_LOGGING_FG_BATCH_SIZE_OPTION); public static final BooleanValidator STATS_LOGGING_BATCH_FG_SIZE_VALIDATOR = new BooleanValidator(STATS_LOGGING_FG_BATCH_SIZE_OPTION);


/** Controls the list of operators for which batch sizing stats should be enabled */
public static final String STATS_LOGGING_BATCH_OPERATOR_OPTION = "drill.exec.stats.logging.enabled_operators";
public static final StringValidator STATS_LOGGING_BATCH_OPERATOR_VALIDATOR = new StringValidator(STATS_LOGGING_BATCH_OPERATOR_OPTION);


} }
Expand Up @@ -82,7 +82,7 @@ public class ScanBatch implements CloseableRecordBatch {
private final BufferAllocator allocator; private final BufferAllocator allocator;
private final List<Map<String, String>> implicitColumnList; private final List<Map<String, String>> implicitColumnList;
private String currentReaderClassName; private String currentReaderClassName;
private final RecordBatchStatsContext batchStatsLogging; private final RecordBatchStatsContext batchStatsContext;


/** /**
* *
Expand Down Expand Up @@ -121,7 +121,7 @@ public ScanBatch(FragmentContext context,
this.implicitColumnList = implicitColumnList; this.implicitColumnList = implicitColumnList;
addImplicitVectors(); addImplicitVectors();
currentReader = null; currentReader = null;
batchStatsLogging = new RecordBatchStatsContext(context, oContext); batchStatsContext = new RecordBatchStatsContext(context, oContext);
} finally { } finally {
oContext.getStats().stopProcessing(); oContext.getStats().stopProcessing();
} }
Expand Down Expand Up @@ -304,12 +304,7 @@ private void logRecordBatchStats() {
return; // NOOP return; // NOOP
} }


RecordBatchStats.logRecordBatchStats( RecordBatchStats.logRecordBatchStats(getFQNForLogging(MAX_FQN_LENGTH), this, batchStatsContext);
batchStatsLogging.getContextOperatorId(),
getFQNForLogging(MAX_FQN_LENGTH),
this,
batchStatsLogging,
logger);
} }


/** Might truncate the FQN if too long */ /** Might truncate the FQN if too long */
Expand Down
Expand Up @@ -46,8 +46,8 @@


/** /**
* <p> {@link OptionManager} that holds options within {@link org.apache.drill.exec.server.DrillbitContext}. * <p> {@link OptionManager} that holds options within {@link org.apache.drill.exec.server.DrillbitContext}.
* Only one instance of this class exists per drillbit. Options set at the system level affect the entire system and * Only one instance of this class exists per drillbit. Options set at the system level affect the entire system and
* persist between restarts. * persist between restarts.
* </p> * </p>
* *
* <p> All the system options are externalized into conf file. While adding a new system option * <p> All the system options are externalized into conf file. While adding a new system option
Expand Down Expand Up @@ -235,6 +235,7 @@ public static CaseInsensitiveMap<OptionDefinition> createDefaultOptionDefinition
new OptionDefinition(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, false)), new OptionDefinition(ExecConstants.OUTPUT_BATCH_SIZE_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, false)),
new OptionDefinition(ExecConstants.STATS_LOGGING_BATCH_SIZE_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM_AND_SESSION, true, true)), new OptionDefinition(ExecConstants.STATS_LOGGING_BATCH_SIZE_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM_AND_SESSION, true, true)),
new OptionDefinition(ExecConstants.STATS_LOGGING_BATCH_FG_SIZE_VALIDATOR,new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM_AND_SESSION, true, true)), new OptionDefinition(ExecConstants.STATS_LOGGING_BATCH_FG_SIZE_VALIDATOR,new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM_AND_SESSION, true, true)),
new OptionDefinition(ExecConstants.STATS_LOGGING_BATCH_OPERATOR_VALIDATOR,new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM_AND_SESSION, true, true)),
new OptionDefinition(ExecConstants.OUTPUT_BATCH_SIZE_AVAIL_MEM_FACTOR_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, false)), new OptionDefinition(ExecConstants.OUTPUT_BATCH_SIZE_AVAIL_MEM_FACTOR_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, false)),
new OptionDefinition(ExecConstants.FRAG_RUNNER_RPC_TIMEOUT_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, true)), new OptionDefinition(ExecConstants.FRAG_RUNNER_RPC_TIMEOUT_VALIDATOR, new OptionMetaData(OptionValue.AccessibleScopes.SYSTEM, true, true)),
}; };
Expand Down
Expand Up @@ -35,6 +35,7 @@
import org.apache.drill.exec.store.parquet.ParquetReaderStats; import org.apache.drill.exec.store.parquet.ParquetReaderStats;
import org.apache.drill.exec.store.parquet.ParquetReaderUtility; import org.apache.drill.exec.store.parquet.ParquetReaderUtility;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager;
import org.apache.drill.exec.util.record.RecordBatchStats.RecordBatchStatsContext;
import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.ValueVector;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
Expand Down Expand Up @@ -240,7 +241,7 @@ public boolean useBulkReader() {
public void setup(OperatorContext operatorContext, OutputMutator output) throws ExecutionSetupException { public void setup(OperatorContext operatorContext, OutputMutator output) throws ExecutionSetupException {
this.operatorContext = operatorContext; this.operatorContext = operatorContext;
schema = new ParquetSchema(fragmentContext.getOptions(), rowGroupIndex, footer, isStarQuery() ? null : getColumns()); schema = new ParquetSchema(fragmentContext.getOptions(), rowGroupIndex, footer, isStarQuery() ? null : getColumns());
batchSizerMgr = new RecordBatchSizerManager(fragmentContext.getOptions(), schema, numRecordsToRead); batchSizerMgr = new RecordBatchSizerManager(fragmentContext.getOptions(), schema, numRecordsToRead, new RecordBatchStatsContext(fragmentContext, operatorContext));


logger.debug("Reading row group({}) with {} records in file {}.", rowGroupIndex, footer.getBlocks().get(rowGroupIndex).getRowCount(), logger.debug("Reading row group({}) with {} records in file {}.", rowGroupIndex, footer.getBlocks().get(rowGroupIndex).getRowCount(),
hadoopPath.toUri().getPath()); hadoopPath.toUri().getPath());
Expand Down
Expand Up @@ -34,11 +34,11 @@
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.FieldOverflowState; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.FieldOverflowState;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.FieldOverflowStateContainer; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.FieldOverflowStateContainer;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.VarLenColumnBatchStats; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchSizerManager.VarLenColumnBatchStats;
import org.apache.drill.exec.util.record.RecordBatchStats;
import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.ValueVector;


/** Class which handles reading a batch of rows from a set of variable columns */ /** Class which handles reading a batch of rows from a set of variable columns */
public class VarLenBinaryReader { public class VarLenBinaryReader {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VarLenBinaryReader.class);


final ParquetRecordReader parentReader; final ParquetRecordReader parentReader;
final RecordBatchSizerManager batchSizer; final RecordBatchSizerManager batchSizer;
Expand Down Expand Up @@ -170,7 +170,8 @@ private void handleColumnOverflow(List<VarLenColumnBatchStats> columnStats, int


// Lazy initialization // Lazy initialization
if (builder == null) { if (builder == null) {
builder = RecordBatchOverflow.newBuilder(parentReader.getOperatorContext().getAllocator()); builder = RecordBatchOverflow.newBuilder(parentReader.getOperatorContext().getAllocator(),
batchSizer.getBatchStatsContext());
} }


final int numOverflowValues = columnStat.numValuesRead - batchNumRecords; final int numOverflowValues = columnStat.numValuesRead - batchNumRecords;
Expand All @@ -181,7 +182,7 @@ private void handleColumnOverflow(List<VarLenColumnBatchStats> columnStats, int
// Register batch overflow data with the record batch sizer manager (if any) // Register batch overflow data with the record batch sizer manager (if any)
if (builder != null) { if (builder != null) {
Map<String, FieldOverflowStateContainer> overflowContainerMap = parentReader.batchSizerMgr.getFieldOverflowMap(); Map<String, FieldOverflowStateContainer> overflowContainerMap = parentReader.batchSizerMgr.getFieldOverflowMap();
Map<String, FieldOverflowDefinition> overflowDefMap = builder.build().getRecordOverflowDefinition().getFieldOverflowDefs(); Map<String, FieldOverflowDefinition> overflowDefMap = builder.build().getRecordOverflowDefinition().getFieldOverflowDefs();


for (Map.Entry<String, FieldOverflowDefinition> entry : overflowDefMap.entrySet()) { for (Map.Entry<String, FieldOverflowDefinition> entry : overflowDefMap.entrySet()) {
FieldOverflowStateContainer overflowStateContainer = new FieldOverflowStateContainer(entry.getValue(), null); FieldOverflowStateContainer overflowStateContainer = new FieldOverflowStateContainer(entry.getValue(), null);
Expand All @@ -197,9 +198,9 @@ private void reorderVLColumns() {
// Finally, re-order the variable length columns since an overflow occurred // Finally, re-order the variable length columns since an overflow occurred
Collections.sort(orderedColumns, comparator); Collections.sort(orderedColumns, comparator);


if (logger.isDebugEnabled()) { if (batchSizer.getBatchStatsContext().isEnableBatchSzLogging()) {
boolean isFirstValue = true; boolean isFirstValue = true;
final StringBuilder msg = new StringBuilder(RecordBatchSizerManager.BATCH_STATS_PREFIX); final StringBuilder msg = new StringBuilder();
msg.append(": Dumping the variable length columns read order: "); msg.append(": Dumping the variable length columns read order: ");


for (VLColumnContainer container : orderedColumns) { for (VLColumnContainer container : orderedColumns) {
Expand All @@ -212,7 +213,7 @@ private void reorderVLColumns() {
} }
msg.append('.'); msg.append('.');


logger.debug(msg.toString()); RecordBatchStats.logRecordBatchStats(msg.toString(), batchSizer.getBatchStatsContext());
} }
} }


Expand Down
Expand Up @@ -26,6 +26,8 @@
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.FieldOverflowEntry; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.FieldOverflowEntry;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.RecordOverflowContainer; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.RecordOverflowContainer;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.RecordOverflowDefinition; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.RecordOverflowDefinition;
import org.apache.drill.exec.util.record.RecordBatchStats;
import org.apache.drill.exec.util.record.RecordBatchStats.RecordBatchStatsContext;
import org.apache.drill.exec.vector.UInt1Vector; import org.apache.drill.exec.vector.UInt1Vector;
import org.apache.drill.exec.vector.UInt4Vector; import org.apache.drill.exec.vector.UInt4Vector;


Expand All @@ -44,7 +46,6 @@
* </ul> * </ul>
*/ */
final class OverflowSerDeUtil { final class OverflowSerDeUtil {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(OverflowSerDeUtil.class);


/** /**
* Serializes a collection of overflow fields into a memory buffer: * Serializes a collection of overflow fields into a memory buffer:
Expand All @@ -56,10 +57,12 @@ final class OverflowSerDeUtil {
* *
* @param fieldOverflowEntries input collection of field overflow entries * @param fieldOverflowEntries input collection of field overflow entries
* @param allocator buffer allocator * @param allocator buffer allocator
* @param batchStatsContext batch statistics context object
* @return record overflow container; null if the input buffer is empty * @return record overflow container; null if the input buffer is empty
*/ */
static RecordOverflowContainer serialize(List<FieldOverflowEntry> fieldOverflowEntries, static RecordOverflowContainer serialize(List<FieldOverflowEntry> fieldOverflowEntries,
BufferAllocator allocator) { BufferAllocator allocator,
RecordBatchStatsContext batchStatsContext) {


if (fieldOverflowEntries == null || fieldOverflowEntries.isEmpty()) { if (fieldOverflowEntries == null || fieldOverflowEntries.isEmpty()) {
return null; return null;
Expand All @@ -82,8 +85,9 @@ static RecordOverflowContainer serialize(List<FieldOverflowEntry> fieldOverflowE
// Allocate the required memory to serialize the overflow fields // Allocate the required memory to serialize the overflow fields
final DrillBuf buffer = allocator.buffer(bufferLength); final DrillBuf buffer = allocator.buffer(bufferLength);


if (logger.isDebugEnabled()) { if (batchStatsContext.isEnableBatchSzLogging()) {
logger.debug(String.format("Allocated a buffer of length %d to handle overflow", bufferLength)); final String msg = String.format("Allocated a buffer of length [%d] to handle overflow", bufferLength);
RecordBatchStats.logRecordBatchStats(msg, batchStatsContext);
} }


// Create the result object // Create the result object
Expand Down
Expand Up @@ -24,6 +24,7 @@
import org.apache.drill.common.map.CaseInsensitiveMap; import org.apache.drill.common.map.CaseInsensitiveMap;
import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.MaterializedField;
import org.apache.drill.exec.util.record.RecordBatchStats.RecordBatchStatsContext;
import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.ValueVector;
import org.apache.drill.exec.vector.VariableWidthVector; import org.apache.drill.exec.vector.VariableWidthVector;


Expand All @@ -39,10 +40,11 @@ public final class RecordBatchOverflow {


/** /**
* @param allocator buffer allocator * @param allocator buffer allocator
* @param batchStatsContext batch statistics context
* @return new builder object * @return new builder object
*/ */
public static Builder newBuilder(BufferAllocator allocator) { public static Builder newBuilder(BufferAllocator allocator, RecordBatchStatsContext batchStatsContext) {
return new Builder(allocator); return new Builder(allocator, batchStatsContext);
} }


/** /**
Expand Down Expand Up @@ -75,13 +77,17 @@ public static final class Builder {
private final List<FieldOverflowEntry> fieldOverflowEntries = new ArrayList<FieldOverflowEntry>(); private final List<FieldOverflowEntry> fieldOverflowEntries = new ArrayList<FieldOverflowEntry>();
/** Buffer allocator */ /** Buffer allocator */
private final BufferAllocator allocator; private final BufferAllocator allocator;
/** Batch statistics context */
private final RecordBatchStatsContext batchStatsContext;


/** /**
* Build class to construct a {@link RecordBatchOverflow} object. * Build class to construct a {@link RecordBatchOverflow} object.
* @param allocator buffer allocator * @param allocator buffer allocator
* @param batchStatsContext batch statistics context
*/ */
private Builder(BufferAllocator allocator) { private Builder(BufferAllocator allocator, RecordBatchStatsContext batchStatsContext) {
this.allocator = allocator; this.allocator = allocator;
this.batchStatsContext = batchStatsContext;
} }


/** /**
Expand All @@ -101,9 +107,8 @@ public void addFieldOverflow(ValueVector vector, int firstValueIdx, int numValue
* @return a new built {link BatchRecordOverflow} object instance * @return a new built {link BatchRecordOverflow} object instance
*/ */
public RecordBatchOverflow build() { public RecordBatchOverflow build() {
RecordOverflowContainer overflowContainer = OverflowSerDeUtil.serialize(fieldOverflowEntries, allocator); RecordOverflowContainer overflowContainer = OverflowSerDeUtil.serialize(fieldOverflowEntries, allocator, batchStatsContext);
RecordBatchOverflow result = RecordBatchOverflow result = new RecordBatchOverflow(overflowContainer.recordOverflowDef, allocator);
new RecordBatchOverflow(overflowContainer.recordOverflowDef, allocator);


return result; return result;
} }
Expand Down
Expand Up @@ -30,6 +30,8 @@
import org.apache.drill.exec.store.parquet.columnreaders.ParquetSchema; import org.apache.drill.exec.store.parquet.columnreaders.ParquetSchema;
import org.apache.drill.exec.store.parquet.columnreaders.VarLenColumnBulkInput; import org.apache.drill.exec.store.parquet.columnreaders.VarLenColumnBulkInput;
import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.FieldOverflowDefinition; import org.apache.drill.exec.store.parquet.columnreaders.batchsizing.RecordBatchOverflow.FieldOverflowDefinition;
import org.apache.drill.exec.util.record.RecordBatchStats;
import org.apache.drill.exec.util.record.RecordBatchStats.RecordBatchStatsContext;
import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.AllocationHelper;
import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.ValueVector;


Expand All @@ -39,7 +41,7 @@
*/ */
public final class RecordBatchSizerManager { public final class RecordBatchSizerManager {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RecordBatchSizerManager.class); private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RecordBatchSizerManager.class);
public static final String BATCH_STATS_PREFIX = "BATCH_STATS";


/** Minimum column memory size */ /** Minimum column memory size */
private static final int MIN_COLUMN_MEMORY_SZ = VarLenColumnBulkInput.getMinVLColumnMemorySize(); private static final int MIN_COLUMN_MEMORY_SZ = VarLenColumnBulkInput.getMinVLColumnMemorySize();
Expand Down Expand Up @@ -78,6 +80,9 @@ public final class RecordBatchSizerManager {
*/ */
private Map<String, FieldOverflowStateContainer> fieldOverflowMap = CaseInsensitiveMap.newHashMap(); private Map<String, FieldOverflowStateContainer> fieldOverflowMap = CaseInsensitiveMap.newHashMap();


/** For controlling batch statistics logging */
private final RecordBatchStatsContext batchStatsContext;

/** /**
* Constructor. * Constructor.
* *
Expand All @@ -87,7 +92,8 @@ public final class RecordBatchSizerManager {
*/ */
public RecordBatchSizerManager(OptionManager options, public RecordBatchSizerManager(OptionManager options,
ParquetSchema schema, ParquetSchema schema,
long totalRecordsToRead) { long totalRecordsToRead,
RecordBatchStatsContext batchStatsContext) {


this.schema = schema; this.schema = schema;
this.totalRecordsToRead = totalRecordsToRead; this.totalRecordsToRead = totalRecordsToRead;
Expand All @@ -97,6 +103,7 @@ public RecordBatchSizerManager(OptionManager options,
this.maxRecordsPerBatch = this.configRecordsPerBatch; this.maxRecordsPerBatch = this.configRecordsPerBatch;
this.recordsPerBatch = this.configRecordsPerBatch; this.recordsPerBatch = this.configRecordsPerBatch;
this.overflowOptimizer = new BatchOverflowOptimizer(columnMemoryInfoMap); this.overflowOptimizer = new BatchOverflowOptimizer(columnMemoryInfoMap);
this.batchStatsContext = batchStatsContext;
} }


/** /**
Expand Down Expand Up @@ -130,6 +137,13 @@ public ParquetSchema getSchema() {
return schema; return schema;
} }


/**
* @return batch statistics context
*/
public RecordBatchStatsContext getBatchStatsContext() {
return batchStatsContext;
}

/** /**
* Allocates value vectors for the current batch. * Allocates value vectors for the current batch.
* *
Expand Down Expand Up @@ -282,10 +296,9 @@ private int normalizeNumRecordsPerBatch() {
normalizedNumRecords = (int) totalRecordsToRead; normalizedNumRecords = (int) totalRecordsToRead;
} }


if (logger.isDebugEnabled()) { if (batchStatsContext.isEnableBatchSzLogging()) {
final String message = String.format("%s: The Parquet reader number of record(s) has been set to [%d]", final String message = String.format("The Parquet reader number of record(s) has been set to [%d]", normalizedNumRecords);
BATCH_STATS_PREFIX, normalizedNumRecords); RecordBatchStats.logRecordBatchStats(message, batchStatsContext);
logger.debug(message);
} }


return normalizedNumRecords; return normalizedNumRecords;
Expand Down Expand Up @@ -319,10 +332,9 @@ private int normalizeMemorySizePerBatch() {
logger.warn(message); logger.warn(message);
} }


if (logger.isDebugEnabled()) { if (batchStatsContext.isEnableBatchSzLogging()) {
final String message = String.format("%s: The Parquet reader batch memory has been set to [%d] byte(s)", final String message = String.format("The Parquet reader batch memory has been set to [%d] byte(s)", normalizedMemorySize);
BATCH_STATS_PREFIX, normalizedMemorySize); RecordBatchStats.logRecordBatchStats(message, batchStatsContext);
logger.debug(message);
} }


return normalizedMemorySize; return normalizedMemorySize;
Expand Down Expand Up @@ -370,13 +382,12 @@ private void assignColumnsBatchMemory() {
assignFineGrainedMemoryQuota(); assignFineGrainedMemoryQuota();


// log the new record batch if it changed // log the new record batch if it changed
if (logger.isDebugEnabled()) { if (batchStatsContext.isEnableBatchSzLogging()) {
assert recordsPerBatch <= maxRecordsPerBatch; assert recordsPerBatch <= maxRecordsPerBatch;


if (originalRecordsPerBatch != recordsPerBatch) { if (originalRecordsPerBatch != recordsPerBatch) {
final String message = String.format("%s: The Parquet records per batch [%d] has been decreased to [%d]", final String message = String.format("The Parquet records per batch [%d] has been decreased to [%d]", originalRecordsPerBatch, recordsPerBatch);
BATCH_STATS_PREFIX, originalRecordsPerBatch, recordsPerBatch); RecordBatchStats.logRecordBatchStats(message, batchStatsContext);
logger.debug(message);
} }


// Now dump the per column memory quotas // Now dump the per column memory quotas
Expand Down Expand Up @@ -504,12 +515,12 @@ private double computeNeededMemoryRatio(MemoryRequirementContainer requiredMemor
} }


private void dumpColumnMemoryQuotas() { private void dumpColumnMemoryQuotas() {
StringBuilder msg = new StringBuilder(BATCH_STATS_PREFIX); StringBuilder msg = new StringBuilder();
msg.append(": Field Quotas:\n\tName\tType\tPrec\tQuota\n"); msg.append(": Field Quotas:\n\tName\tType\tPrec\tQuota\n");


for (ColumnMemoryInfo columnInfo : columnMemoryInfoMap.values()) { for (ColumnMemoryInfo columnInfo : columnMemoryInfoMap.values()) {
msg.append("\t"); msg.append("\t");
msg.append(BATCH_STATS_PREFIX); msg.append(RecordBatchStats.BATCH_STATS_PREFIX);
msg.append("\t"); msg.append("\t");
msg.append(columnInfo.columnMeta.getField().getName()); msg.append(columnInfo.columnMeta.getField().getName());
msg.append("\t"); msg.append("\t");
Expand All @@ -521,7 +532,7 @@ private void dumpColumnMemoryQuotas() {
msg.append("\n"); msg.append("\n");
} }


logger.debug(msg.toString()); RecordBatchStats.logRecordBatchStats(msg.toString(), batchStatsContext);
} }


private static void printType(MaterializedField field, StringBuilder msg) { private static void printType(MaterializedField field, StringBuilder msg) {
Expand Down

0 comments on commit 80fb761

Please sign in to comment.