Package io.trino.operator.output
Class PagePartitioner
java.lang.Object
io.trino.operator.output.PagePartitioner
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionPagePartitioner(PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, List<Type> sourceTypes, io.airlift.units.DataSize maxMemory, PositionsAppenderFactory positionsAppenderFactory, Optional<io.airlift.slice.Slice> exchangeEncryptionKey, AggregatedMemoryContext aggregatedMemoryContext, boolean partitionProcessRleAndDictionaryBlocks) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidpartitionPage(Page page, OperatorContext operatorContext) voidpartitionPageByColumn(Page page) voidpartitionPageByRow(Page page) voidprepareForRelease(OperatorContext operatorContext) Prepares thisPagePartitionerfor release to the pool by checking for dictionary mode appenders and either flattening them into direct appenders or forcing their current pages to flush to preserve a valuable dictionary encoded representation.
-
Constructor Details
-
PagePartitioner
public PagePartitioner(PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, List<Type> sourceTypes, io.airlift.units.DataSize maxMemory, PositionsAppenderFactory positionsAppenderFactory, Optional<io.airlift.slice.Slice> exchangeEncryptionKey, AggregatedMemoryContext aggregatedMemoryContext, boolean partitionProcessRleAndDictionaryBlocks)
-
-
Method Details
-
getPartitionFunction
-
partitionPage
-
prepareForRelease
Prepares thisPagePartitionerfor release to the pool by checking for dictionary mode appenders and either flattening them into direct appenders or forcing their current pages to flush to preserve a valuable dictionary encoded representation. This is done before release because we know that after reuse, the appenders will not observe any more inputs using the same dictionary.When a
PagePartitioneris released back to thePagePartitionerPoolwe don't know if it will ever be reused. If it is not reused, then we have noOperatorContextwe can use to report the output size of the final flushed page, so instead we report the buffered bytes still in the partitioner afterprepareForRelease(OperatorContext)as output bytes eagerly and record that amount inoutputSizeReportedBeforeRelease. If thePagePartitioneris reused after having reported buffered bytes eagerly, we then have to subtract that same amount from the subsequent output bytes to avoid double counting them. -
partitionPageByRow
-
partitionPageByColumn
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-