Skip to main content

Module rewrite

Module rewrite 

Source
Expand description

Rewrite expressions in preparation for files being scanned, such as scan-metadata scalar UDFs.

Functions like file_row_index() and input_file_name() are placeholders whose value is only known during a file scan. The helpers here replace those UDFs with ordinary physical expressions bound to the current file: a column reference into a source-provided row-index column, or a per-file literal, etc.

Functionsยง

expr_references_scalar_udf
Return true if a PhysicalExpr references scalar UDF T.
rewrite_file_row_index_expr
Rewrite file_row_index() in a PhysicalExpr to read from a source-provided row-index column.
rewrite_file_row_index_projection
Rewrite file_row_index() in pushed ProjectionExprs to read from a source-provided row-index column.
rewrite_input_file_name_in_projection
Rewrite input_file_name() in pushed ProjectionExprs to a per-file Literal holding file_name.