Function datafusion_physical_plan::windows::get_window_mode

source ยท
pub fn get_window_mode(
    partitionby_exprs: &[Arc<dyn PhysicalExpr>],
    orderby_keys: &[PhysicalSortExpr],
    input: &Arc<dyn ExecutionPlan>,
) -> Option<(bool, InputOrderMode)>
Expand description

Compares physical ordering (output ordering of the input operator) with partitionby_exprs and orderby_keys to decide whether existing ordering is sufficient to run the current window operator.

  • A None return value indicates that we can not remove the sort in question (input ordering is not sufficient to run current window executor).
  • A Some((bool, InputOrderMode)) value indicates that the window operator can run with existing input ordering, so we can remove SortExec before it.

The bool field in the return value represents whether we should reverse window operator to remove SortExec before it. The InputOrderMode field represents the mode this window operator should work in to accommodate the existing ordering.