Skip to main content

can_forward_watermark_on_order_key

Function can_forward_watermark_on_order_key 

Source
pub fn can_forward_watermark_on_order_key<'a>(
    frames: impl IntoIterator<Item = &'a Frame>,
    first_order_type: OrderType,
) -> bool
Expand description

Whether a watermark on the first ORDER BY column can be forwarded through a general (i.e. non-EOWC) streaming over window operator evaluating the given frames, which all share the same PARTITION BY and ORDER BY clauses.

A watermark wm on a column promises that no row with the column value < wm will ever arrive again. To forward it, the operator must guarantee that the outputs of rows with the column value < wm will never change again, which holds when a row can only affect (i.e. be included in the frames of) rows that are not “smaller” than itself in the column:

  • the column is ordered ASC and no frame extends to following rows, or
  • the column is ordered DESC and no frame extends to preceding rows.

Additionally, NULLs must be ordered as the largest values (ASC NULLS LAST or DESC NULLS FIRST). Rows with NULL in the column are not covered by the watermark guarantee, so they must also land on the “larger” side to never affect rows below the watermark.