public class PartitionerDecorator extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
PartitionerDecorator.GeneralExecuteIface
Helper interface to generalize functionality executed in the thread
since it is absolutely the same for partitionBatch and flushOutgoingBatches
protected is for testing purposes
|
| Constructor and Description |
|---|
PartitionerDecorator(List<Partitioner> partitioners,
OperatorStats stats,
FragmentContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
decorator method to call multiple Partitioners clear()
|
protected void |
executeMethodLogic(PartitionerDecorator.GeneralExecuteIface iface)
Helper to execute the different methods wrapped into same logic
|
void |
flushOutgoingBatches(boolean isLastBatch,
boolean schemaChanged)
flushOutgoingBatches - decorator to call real Partitioner(s) flushOutgoingBatches
|
PartitionOutgoingBatch |
getOutgoingBatches(int index)
Helper method to get PartitionOutgoingBatch based on the index
since we may have more then one Partitioner
As number of Partitioners should be very small AND this method it used very rarely,
so it is OK to loop in order to find right partitioner
|
protected List<Partitioner> |
getPartitioners() |
void |
initialize()
decorator method to call multiple Partitioners initialize()
|
void |
partitionBatch(RecordBatch incoming)
partitionBatch - decorator method to call real Partitioner(s) to process incoming batch
uses either threading or not threading approach based on number Partitioners
|
public PartitionerDecorator(List<Partitioner> partitioners, OperatorStats stats, FragmentContext context)
public void partitionBatch(RecordBatch incoming) throws IOException
incoming - IOExceptionpublic void flushOutgoingBatches(boolean isLastBatch,
boolean schemaChanged)
throws IOException
isLastBatch - schemaChanged - IOExceptionpublic void initialize()
public void clear()
public PartitionOutgoingBatch getOutgoingBatches(int index)
index - - index of PartitionOutgoingBatchprotected List<Partitioner> getPartitioners()
protected void executeMethodLogic(PartitionerDecorator.GeneralExecuteIface iface) throws IOException
iface - IOExceptionCopyright © 2017 The Apache Software Foundation. All rights reserved.