Commit 5b0a42e
committed
fix: address review feedback — avoid stale SPM and decouple spm capture from fetch
- Capture only the LexOrdering from the stripped SortPreservingMergeExec
instead of the entire plan node, then reconstruct a fresh SPM with the
current (possibly rewritten) child plan in the fallback path. This
avoids reusing a stale SPM that references an outdated subtree.
- Decouple spm_ordering capture from fetch — use `spm_ordering.is_none()`
instead of gating on `fetch.is_none()`, so the SPM ordering is recorded
even when an outer operator already set fetch.
- Remove unwrap() on with_fetch by constructing SPM directly.
- Fix test comment: fallback is CoalescePartitionsExec/SPM, not GlobalLimitExec.
- Add regression test: nested CoalescePartitionsExec(fetch=5) over
SortPreservingMergeExec(fetch=3) now correctly preserves SPM ordering.1 parent 7785c33 commit 5b0a42e
2 files changed
Lines changed: 73 additions & 17 deletions
File tree
- datafusion
- core/tests/physical_optimizer
- physical-optimizer/src
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3934 | 3934 | | |
3935 | 3935 | | |
3936 | 3936 | | |
3937 | | - | |
| 3937 | + | |
3938 | 3938 | | |
3939 | 3939 | | |
3940 | 3940 | | |
| |||
3994 | 3994 | | |
3995 | 3995 | | |
3996 | 3996 | | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
3997 | 4042 | | |
3998 | 4043 | | |
3999 | 4044 | | |
| |||
Lines changed: 27 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
1017 | 1018 | | |
1018 | 1019 | | |
1019 | 1020 | | |
1020 | | - | |
1021 | 1021 | | |
1022 | 1022 | | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
| 1023 | + | |
1028 | 1024 | | |
1029 | | - | |
| 1025 | + | |
1030 | 1026 | | |
1031 | 1027 | | |
1032 | 1028 | | |
1033 | 1029 | | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1034 | 1042 | | |
1035 | 1043 | | |
1036 | 1044 | | |
1037 | 1045 | | |
1038 | 1046 | | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | 1047 | | |
1043 | 1048 | | |
1044 | 1049 | | |
| |||
1047 | 1052 | | |
1048 | 1053 | | |
1049 | 1054 | | |
1050 | | - | |
| 1055 | + | |
1051 | 1056 | | |
1052 | 1057 | | |
1053 | 1058 | | |
| |||
1250 | 1255 | | |
1251 | 1256 | | |
1252 | 1257 | | |
1253 | | - | |
| 1258 | + | |
1254 | 1259 | | |
1255 | 1260 | | |
1256 | 1261 | | |
| |||
1518 | 1523 | | |
1519 | 1524 | | |
1520 | 1525 | | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
1524 | 1535 | | |
1525 | 1536 | | |
1526 | 1537 | | |
| |||
0 commit comments