Module fix_order

Module fix_order 

Source

Structsยง

FixOrderingRewriter ๐Ÿ”’
FixStateUdafOrderingAnalyzer
Traverse the plan, found all __<aggr_name>_state and fix their ordering fields if their input aggr is with order by, this is currently only useful for first_value and last_value udaf
UnFixStateUdafOrderingAnalyzer
Traverse the plan, found all __<aggr_name>_state and remove their ordering fields this is currently only useful for first_value and last_value udaf when need to encode to substrait

Functionsยง

rewrite_expr ๐Ÿ”’
first see the aggr node in expr as it could be nested aggr like alias(aggr(sort)) if contained aggr expr have a order by, and the aggr name match the regex then we need to fix the ordering field of the state udaf to be the same as the aggr expr