Repository navigation
Commit 7b24735
authored
Add resolve_lambda_variables helper to Expr and LogicalPlan (apache#22101)
## Which issue does this PR close?
Part of apache#21172
## Rationale for this change
This has been pulled out from main lambda PR to reduce it's size.
Currently, the `LambdaVariable` field is an `Option<FieldRef>` but must
be set manually for `expr_api` users (see below, passing `None` would
result in planning/execution errors). This is similar to
`Expr::Placeholder` field and its helper `Expr::infer_placeholder_types`
https://github.com/apache/datafusion/blob/7f2f78d48b6d3d6aee2ce2fd29910bb4c11b1012/datafusion/functions-nested/src/array_transform.rs#L328-L341
Now it can be omitted and later resolved by the new helpers:
https://github.com/apache/datafusion/blob/7c266c10e806cf87edfe5a2eccccccf639fdb2fe/datafusion/functions-nested/src/array_transform.rs#L326-L330
## What changes are included in this PR?
This PR adds the method `resolve_lambda_variables` to `Expr` and
`LogicalPlan` to automatically resolve all variables of the given expr
or logical plan. Nothing changes for sql planning
## Are these changes tested?
There's a unit test which should cover all edge cases. Is not trivial to
test via sqllogictests because sql planning produces already resolved
lambda variables.
## Are there any user-facing changes?
New methods added only1 parent b426232 commit 7b24735
7 files changed
Lines changed: 569 additions & 45 deletions
File tree
- datafusion
- common/src
- expr/src
- logical_plan
- functions-nested/src
- sql/src/unparser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
457 | 462 | | |
458 | 463 | | |
459 | 464 | | |
| |||
496 | 501 | | |
497 | 502 | | |
498 | 503 | | |
499 | | - | |
500 | | - | |
501 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
502 | 518 | | |
503 | 519 | | |
504 | 520 | | |
| |||
507 | 523 | | |
508 | 524 | | |
509 | 525 | | |
510 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
511 | 532 | | |
512 | 533 | | |
513 | 534 | | |
| |||
2229 | 2250 | | |
2230 | 2251 | | |
2231 | 2252 | | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2232 | 2263 | | |
2233 | 2264 | | |
2234 | 2265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
735 | 739 | | |
736 | 740 | | |
737 | 741 | | |
| |||
0 commit comments