Module plan_rewrite

Source

Macrosยง

inconsistent_check ๐Ÿ”’

Structsยง

RangeExprRewriter
RangeExprRewriter will recursively search certain Expr, find all range_fn scalar udf contained in Expr, and collect the information required by the RangeSelect query, and finally modify the range_fn scalar udf to an ordinary column field.
RangePlanRewriter
In order to implement RangeSelect query like avg(field_0) RANGE '5m' FILL NULL, All RangeSelect query items are converted into udf scalar function in sql parse stage, with format like range_fn(avg(field_0), .....). range_fn contains all the parameters we need to execute RangeSelect. In order to correctly execute the query process of range select, we need to modify the query plan generated by datafusion. We need to recursively find the entire LogicalPlan, and find all range_fn scalar udf contained in the project plan, collecting info we need to generate RangeSelect Query LogicalPlan and rewrite th original LogicalPlan.

Functionsยง

dispose_parse_error ๐Ÿ”’
evaluate_expr_to_millisecond ๐Ÿ”’
Evaluate a time calculation expr, case like:
have_range_in_exprs ๐Ÿ”’
interval_only_in_expr ๐Ÿ”’
parse_align_to ๐Ÿ”’
Parse the align to clause and return a UTC timestamp with unit of millisecond, which is used as the basis for dividing time slot during the align operation.
parse_duration_expr ๐Ÿ”’
Parse a duraion expr:
parse_expr_list ๐Ÿ”’
parse_expr_to_string ๐Ÿ”’
parse_str_expr ๐Ÿ”’