You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`LambdaExpr` previously compressed the column-index projection by
enumerating all referenced indices and packing them into the front of
the merged evaluation batch. That collapse is correct for outer
captures, but it also moved lambda parameters around: a two-parameter
lambda `(k, v) -> v` (where `k` is unused) would have its
`LambdaVariable` for `v` re-projected from index 1 to index 0, so at
runtime it would read the slot the higher-order function had filled
with `k`.
`LambdaExpr` now tracks `outer_columns_count` (the size of the outer
schema the lambda was planned against). Indices below that boundary are
treated as captures and compressed; indices at or above it are treated
as lambda parameters and keep their fixed offset from the start of the
parameter block, so unused parameters leave a gap rather than shifting
the used ones.
This is a breaking change to `LambdaExpr::try_new` and the
`expressions::lambda(...)` helper: both now take an extra
`outer_columns_count: usize` parameter, and `create_physical_expr`
forwards it from the outer DFSchema. Extracted from #22689 because it
needs separate review attention.
/// Number of columns in the outer input schema. Column/LambdaVariable
47
+
/// indices below this value reference outer captures; indices at or above
48
+
/// reference lambda parameters (whose position in the merged evaluation
49
+
/// batch is fixed by the higher-order function, not by the projection).
50
+
outer_columns_count:usize,
46
51
}
47
52
48
53
// Manually derive PartialEq and Hash to work around https://github.com/rust-lang/rust/issues/78808 [https://github.com/apache/datafusion/issues/13196]
@@ -60,8 +65,19 @@ impl Hash for LambdaExpr {
60
65
}
61
66
62
67
implLambdaExpr{
63
-
/// Create a new lambda expression with the given parameters and body
0 commit comments