Class PagePartitioner

java.lang.Object
io.trino.operator.output.PagePartitioner
All Implemented Interfaces:
Closeable, AutoCloseable

public class PagePartitioner extends Object implements Closeable
  • Constructor Details

  • Method Details

    • getPartitionFunction

      public PartitionFunction getPartitionFunction()
    • partitionPage

      public void partitionPage(Page page, OperatorContext operatorContext)
    • prepareForRelease

      public void prepareForRelease(OperatorContext operatorContext)
      Prepares this PagePartitioner for 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 PagePartitioner is released back to the PagePartitionerPool we don't know if it will ever be reused. If it is not reused, then we have no OperatorContext we can use to report the output size of the final flushed page, so instead we report the buffered bytes still in the partitioner after prepareForRelease(OperatorContext) as output bytes eagerly and record that amount in outputSizeReportedBeforeRelease. If the PagePartitioner is 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

      public void partitionPageByRow(Page page)
    • partitionPageByColumn

      public void partitionPageByColumn(Page page)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable