fn derive_predicate_from_eq_condition(
expr: &ExprImpl,
eq_condition: &EqJoinPredicate,
col_num: usize,
expr_is_left: bool,
) -> Option<ExprImpl>
Expand description
We are trying to derive a predicate to apply to the other side of a join if all
the InputRef
s in the predicate are eq condition columns, and can hence be substituted
with the corresponding eq condition columns of the other side.
Strategy:
- If the function is pure except for any
InputRef
(which may refer to impure computation), then we proceed. Else abort. - Then, we collect
InputRef
s in the conjunction. - If they are all columns in the given side of join eq condition, then we proceed. Else abort.
- We then rewrite the
ExprImpl
, by replacingInputRef
column indices with the equivalent in the other side.
ยงArguments
Suppose we derive a predicate from the left side to be pushed to the right side.
expr
: An expr from the left side.col_num
: The number of columns in the left side.