Package org.apache.drill.exec.record
Class RecordBatchMemoryManager
java.lang.Object
org.apache.drill.exec.record.RecordBatchMemoryManager
- Direct Known Subclasses:
JoinBatchMemoryManager
,ProjectMemoryManager
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
-
Constructor Summary
ConstructorDescriptionRecordBatchMemoryManager
(int configuredOutputSize) RecordBatchMemoryManager
(int numInputs, int configuredOutputSize) -
Method Summary
Modifier and TypeMethodDescriptionstatic int
adjustOutputRowCount
(int rowCount) This will adjust rowCount taking into account the min and max that is allowed.void
allocateVectors
(List<ValueVector> valueVectors) void
allocateVectors
(List<ValueVector> valueVectors, int recordCount) void
allocateVectors
(VectorContainer container) void
allocateVectors
(VectorContainer container, int recordCount) static int
computeOutputRowCount
(int batchSize, int rowWidth) long
long
getAvgInputBatchSize
(int index) long
long
getAvgInputRowWidth
(int index) long
long
getColumnSize
(int index, String name) getColumnSize
(String name) int
Should be used as maximum output row count that can be filled in output batch which is already allocated.long
long
getNumIncomingBatches
(int index) long
int
int
int
int
Should be used as maximum output row count that can be filled in output batch when a new output batch is allocated after calling update on BatchMemoryManager.getRecordBatchSizer
(int index) long
long
getTotalInputRecords
(int index) long
void
setCurrentOutgoingMaxRowCount
(int newTargetOutputCount) Set the max row count which the current output batch (already allocated) can contain.void
setOutgoingRowWidth
(int outgoingRowWidth) void
setOutputRowCount
(int outputRowCount) void
setOutputRowCount
(int targetBatchSize, int rowWidth) Given batchSize and rowWidth, this will set output rowCount taking into account the min and max that is allowed.void
setRecordBatchSizer
(int index, RecordBatchSizer sizer) void
void
update()
void
update
(int inputIndex) void
update
(int inputIndex, int outputPosition) void
update
(int inputIndex, int outputPosition, boolean useAggregate) void
update
(RecordBatch recordBatch) void
update
(RecordBatch recordBatch, int index) void
update
(RecordBatch batch, int inputIndex, int outputPosition) void
update
(RecordBatch batch, int inputIndex, int outputPosition, boolean useAggregate) boolean
updateIfNeeded
(int newOutgoingRowWidth) void
void
updateIncomingStats
(int index) void
updateOutgoingStats
(int outputRecords)
-
Field Details
-
MAX_NUM_ROWS
protected static final int MAX_NUM_ROWS- See Also:
-
MIN_NUM_ROWS
protected static final int MIN_NUM_ROWS- See Also:
-
DEFAULT_INPUT_INDEX
protected static final int DEFAULT_INPUT_INDEX- See Also:
-
-
Constructor Details
-
RecordBatchMemoryManager
public RecordBatchMemoryManager(int numInputs, int configuredOutputSize) -
RecordBatchMemoryManager
public RecordBatchMemoryManager(int configuredOutputSize)
-
-
Method Details
-
getNumOutgoingBatches
public long getNumOutgoingBatches() -
getTotalOutputRecords
public long getTotalOutputRecords() -
getAvgOutputBatchSize
public long getAvgOutputBatchSize() -
getAvgOutputRowWidth
public long getAvgOutputRowWidth() -
getNumIncomingBatches
public long getNumIncomingBatches() -
getAvgInputBatchSize
public long getAvgInputBatchSize() -
getAvgInputRowWidth
public long getAvgInputRowWidth() -
getTotalInputRecords
public long getTotalInputRecords() -
getNumIncomingBatches
public long getNumIncomingBatches(int index) -
getAvgInputBatchSize
public long getAvgInputBatchSize(int index) -
getAvgInputRowWidth
public long getAvgInputRowWidth(int index) -
getTotalInputRecords
public long getTotalInputRecords(int index) -
update
public void update(int inputIndex) -
update
public void update() -
update
-
update
-
update
public void update(int inputIndex, int outputPosition, boolean useAggregate) -
update
public void update(int inputIndex, int outputPosition) -
update
-
update
-
updateIfNeeded
public boolean updateIfNeeded(int newOutgoingRowWidth) -
getOutputRowCount
public int getOutputRowCount()Should be used as maximum output row count that can be filled in output batch when a new output batch is allocated after calling update on BatchMemoryManager.- Returns:
- outputRowCount max output row count
-
getCurrentOutgoingMaxRowCount
public int getCurrentOutgoingMaxRowCount()Should be used as maximum output row count that can be filled in output batch which is already allocated.- Returns:
- currentOutgoingMaxRowCount max output row count for current output batch
-
setOutputRowCount
public void setOutputRowCount(int targetBatchSize, int rowWidth) Given batchSize and rowWidth, this will set output rowCount taking into account the min and max that is allowed. -
setOutputRowCount
public void setOutputRowCount(int outputRowCount) -
setCurrentOutgoingMaxRowCount
public void setCurrentOutgoingMaxRowCount(int newTargetOutputCount) Set the max row count which the current output batch (already allocated) can contain. Since this setter doesn't adjust the input value we make sure it doesn't go above MAX_NUM_ROWS- Parameters:
newTargetOutputCount
-
-
adjustOutputRowCount
public static int adjustOutputRowCount(int rowCount) This will adjust rowCount taking into account the min and max that is allowed. We will round down to nearest power of two - 1 for better memory utilization. -1 is done for adjusting accounting for offset vectors. -
computeOutputRowCount
public static int computeOutputRowCount(int batchSize, int rowWidth) -
setOutgoingRowWidth
public void setOutgoingRowWidth(int outgoingRowWidth) -
getOutgoingRowWidth
public int getOutgoingRowWidth() -
setRecordBatchSizer
-
setRecordBatchSizer
-
getRecordBatchSizer
-
getRecordBatchSizer
-
getColumnSize
-
getColumnSize
-
updateIncomingStats
public void updateIncomingStats(int index) -
updateIncomingStats
public void updateIncomingStats() -
updateOutgoingStats
public void updateOutgoingStats(int outputRecords) -
getOutputBatchSize
public int getOutputBatchSize() -
getOffsetVectorWidth
public int getOffsetVectorWidth() -
allocateVectors
-
allocateVectors
-
allocateVectors
-
allocateVectors
-