public class BatchSizePredictorImpl extends Object implements BatchSizePredictor
| Modifier and Type | Class and Description |
|---|---|
static class |
BatchSizePredictorImpl.Factory |
| Constructor and Description |
|---|
BatchSizePredictorImpl(RecordBatch batch,
double fragmentationFactor,
double safetyFactor) |
| Modifier and Type | Method and Description |
|---|---|
static long |
computeMaxBatchSize(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords,
double fragmentationFactor,
double safetyFactor,
boolean reserveHash) |
static long |
computeMaxBatchSizeNoHash(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords,
double fragmentationFactor,
double safetyFactor) |
static long |
computePartitionBatchSize(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords) |
static long |
computeValueVectorSize(long numRecords,
long byteSize) |
static long |
computeValueVectorSize(long numRecords,
long byteSize,
double safetyFactor) |
long |
getBatchSize()
Gets the batchSize computed in the call to
BatchSizePredictor.updateStats(). |
static long |
getBatchSizeEstimate(RecordBatch recordBatch) |
int |
getNumRecords()
Gets the number of records computed in the call to
BatchSizePredictor.updateStats(). |
boolean |
hadDataLastTime()
True if the input batch had records in the last call to
BatchSizePredictor.updateStats(). |
long |
predictBatchSize(int desiredNumRecords,
boolean reserveHash)
Predicts the size of a batch using the current collected stats.
|
static long |
roundUpToPowerOf2(long num) |
void |
updateStats()
This method can be called multiple times to collect stats about the latest data in the provided record batch.
|
public BatchSizePredictorImpl(RecordBatch batch, double fragmentationFactor, double safetyFactor)
public long getBatchSize()
BatchSizePredictorBatchSizePredictor.updateStats(). Returns 0 if BatchSizePredictor.hadDataLastTime() is false.getBatchSize in interface BatchSizePredictorBatchSizePredictor.updateStats(). Returns 0 if BatchSizePredictor.hadDataLastTime() is false.public int getNumRecords()
BatchSizePredictorBatchSizePredictor.updateStats(). Returns 0 if BatchSizePredictor.hadDataLastTime() is false.getNumRecords in interface BatchSizePredictorBatchSizePredictor.updateStats(). Returns 0 if BatchSizePredictor.hadDataLastTime() is false.public boolean hadDataLastTime()
BatchSizePredictorBatchSizePredictor.updateStats(). False otherwise.hadDataLastTime in interface BatchSizePredictorBatchSizePredictor.updateStats(). False otherwise.public void updateStats()
BatchSizePredictorBatchSizePredictor.predictBatchSize(int, boolean).updateStats in interface BatchSizePredictorpublic long predictBatchSize(int desiredNumRecords,
boolean reserveHash)
BatchSizePredictorpredictBatchSize in interface BatchSizePredictordesiredNumRecords - The number of records contained in the batch whose size we want to predict.reserveHash - Whether or not to include a column containing hash values.public static long computeValueVectorSize(long numRecords,
long byteSize)
public static long computeValueVectorSize(long numRecords,
long byteSize,
double safetyFactor)
public static long roundUpToPowerOf2(long num)
public static long computeMaxBatchSizeNoHash(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords,
double fragmentationFactor,
double safetyFactor)
public static long computeMaxBatchSize(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords,
double fragmentationFactor,
double safetyFactor,
boolean reserveHash)
public static long computePartitionBatchSize(long incomingBatchSize,
int incomingNumRecords,
int desiredNumRecords)
public static long getBatchSizeEstimate(RecordBatch recordBatch)
Copyright © 2021 The Apache Software Foundation. All rights reserved.