PartitionSearcher

Trait PartitionSearcher 

Source
trait PartitionSearcher: Send {
    // Required methods
    fn calculate_out_columns(
        &mut self,
        input_buffer: &RecordBatch,
        window_agg_states: &[PartitionWindowAggStates],
        partition_buffers: &mut PartitionBatches,
        window_expr: &[Arc<dyn WindowExpr>],
    ) -> Result<Option<Vec<ArrayRef>>>;
    fn evaluate_partition_batches(
        &mut self,
        record_batch: &RecordBatch,
        window_expr: &[Arc<dyn WindowExpr>],
    ) -> Result<Vec<(PartitionKey, RecordBatch)>>;
    fn mark_partition_end(&self, partition_buffers: &mut PartitionBatches);
    fn input_schema(&self) -> &SchemaRef;

    // Provided methods
    fn is_mode_linear(&self) -> bool { ... }
    fn prune(&mut self, _n_out: usize) { ... }
    fn update_partition_batch(
        &mut self,
        input_buffer: &mut RecordBatch,
        record_batch: RecordBatch,
        window_expr: &[Arc<dyn WindowExpr>],
        partition_buffers: &mut PartitionBatches,
    ) -> Result<()> { ... }
}
Expand description

Trait that specifies how we search for (or calculate) partitions. It has two implementations: SortedSearch and LinearSearch.

Required Methods§

Source

fn calculate_out_columns( &mut self, input_buffer: &RecordBatch, window_agg_states: &[PartitionWindowAggStates], partition_buffers: &mut PartitionBatches, window_expr: &[Arc<dyn WindowExpr>], ) -> Result<Option<Vec<ArrayRef>>>

This method constructs output columns using the result of each window expression (each entry in the output vector comes from a window expression). Executor when producing output concatenates input_buffer (corresponding section), and result of this function to generate output RecordBatch. input_buffer is used to determine which sections of the window expression results should be used to generate output. partition_buffers contains corresponding section of the RecordBatch for each partition. window_agg_states stores per partition state for each window expression. None case means that no result is generated Some(Vec<ArrayRef>) is the result of each window expression.

Source

fn evaluate_partition_batches( &mut self, record_batch: &RecordBatch, window_expr: &[Arc<dyn WindowExpr>], ) -> Result<Vec<(PartitionKey, RecordBatch)>>

Source

fn mark_partition_end(&self, partition_buffers: &mut PartitionBatches)

Marks the partition as done if we are sure that corresponding partition cannot receive any more values.

Source

fn input_schema(&self) -> &SchemaRef

Provided Methods§

Source

fn is_mode_linear(&self) -> bool

Determine whether [InputOrderMode] is [InputOrderMode::Linear] or not.

Source

fn prune(&mut self, _n_out: usize)

Prunes the state.

Source

fn update_partition_batch( &mut self, input_buffer: &mut RecordBatch, record_batch: RecordBatch, window_expr: &[Arc<dyn WindowExpr>], partition_buffers: &mut PartitionBatches, ) -> Result<()>

Updates input_buffer and partition_buffers with the new record_batch.

Implementors§