Commit f51c8fd
[SPARK-22944][SQL] improve FoldablePropagation
## What changes were proposed in this pull request?
`FoldablePropagation` is a little tricky as it needs to handle attributes that are miss-derived from children, e.g. outer join outputs. This rule does a kind of stop-able tree transform, to skip to apply this rule when hit a node which may have miss-derived attributes.
Logically we should be able to apply this rule above the unsupported nodes, by just treating the unsupported nodes as leaf nodes. This PR improves this rule to not stop the tree transformation, but reduce the foldable expressions that we want to propagate.
## How was this patch tested?
existing tests
Author: Wenchen Fan <[email protected]>
Closes #20139 from cloud-fan/foldable.
(cherry picked from commit 7d045c5)
Signed-off-by: gatorsmile <[email protected]>1 parent a51212b commit f51c8fd
File tree
2 files changed
+58
-30
lines changed- sql/catalyst/src
- main/scala/org/apache/spark/sql/catalyst/optimizer
- test/scala/org/apache/spark/sql/catalyst/optimizer
2 files changed
+58
-30
lines changedLines changed: 37 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
510 | 509 | | |
511 | | - | |
512 | | - | |
| 510 | + | |
| 511 | + | |
513 | 512 | | |
514 | 513 | | |
515 | | - | |
516 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
517 | 520 | | |
518 | 521 | | |
519 | 522 | | |
520 | | - | |
| 523 | + | |
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
| |||
530 | 533 | | |
531 | 534 | | |
532 | 535 | | |
533 | | - | |
534 | 536 | | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | 537 | | |
541 | | - | |
| 538 | + | |
542 | 539 | | |
543 | 540 | | |
544 | | - | |
545 | | - | |
546 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
547 | 545 | | |
548 | 546 | | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
558 | 564 | | |
559 | 565 | | |
560 | | - | |
561 | | - | |
562 | 566 | | |
563 | | - | |
564 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
565 | 574 | | |
566 | 575 | | |
567 | 576 | | |
| |||
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/FoldablePropagationSuite.scala
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
164 | 183 | | |
0 commit comments