pub fn to_substrait_rex(
    ctx: &SessionContext,
    expr: &Expr,
    schema: &DFSchemaRef,
    col_ref_offset: usize,
    extensions: &mut Extensions,
) -> Result<Expression>
Expand description

Convert DataFusion Expr to Substrait Rex

§Arguments

  • expr - DataFusion expression to be parse into a Substrait expression
  • schema - DataFusion input schema for looking up field qualifiers
  • col_ref_offset - Offset for calculating Substrait field reference indices. This should only be set by caller with more than one input relations i.e. Join. Substrait expects one set of indices when joining two relations. Let’s say left and right have m and n columns, respectively. The right relation will have column indices from 0 to n-1, however, Substrait will expect the right indices to be offset by the left. This means Substrait will expect to evaluate the join condition expression on indices [0 .. n-1, n .. n+m-1]. For example: SELECT * FROM t1 JOIN t2 ON t1.c1 = t2.c0; where t1 consists of columns [c0, c1, c2], and t2 = columns [c0, c1] the join condition should become col_ref(1) = col_ref(3 + 0) , where 3 is the number of left columns (col_ref_offset) and 0 is the index of the join key column from right
  • extensions - Substrait extension info. Contains registered function information