Commit 9463ce2
committed
[SPARK-39835][SQL] Fix EliminateSorts remove global sort below the local sort
Correct the `EliminateSorts` follows:
- If the upper sort is global then we can remove the global or local sort recursively.
- If the upper sort is local then we can only remove the local sort recursively.
If a global sort below locol sort, we should not remove the global sort becuase the output partitioning can be affected.
This issue is going to worse since we pull out the V1 Write sort to logcial side.
yes, bug fix
add test
Closes #37250 from ulysses-you/remove-sort.
Authored-by: ulysses-you <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>1 parent 421918d commit 9463ce2
File tree
2 files changed
+37
-7
lines changed- sql/catalyst/src
- main/scala/org/apache/spark/sql/catalyst/optimizer
- test/scala/org/apache/spark/sql/catalyst/optimizer
2 files changed
+37
-7
lines changedLines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1332 | 1332 | | |
1333 | 1333 | | |
1334 | 1334 | | |
1335 | | - | |
| 1335 | + | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| |||
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
1345 | | - | |
| 1345 | + | |
1346 | 1346 | | |
1347 | | - | |
| 1347 | + | |
| 1348 | + | |
1348 | 1349 | | |
1349 | | - | |
| 1350 | + | |
1350 | 1351 | | |
1351 | 1352 | | |
1352 | | - | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1353 | 1360 | | |
1354 | 1361 | | |
1355 | 1362 | | |
1356 | 1363 | | |
1357 | | - | |
| 1364 | + | |
| 1365 | + | |
1358 | 1366 | | |
1359 | | - | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
1360 | 1370 | | |
1361 | 1371 | | |
1362 | 1372 | | |
1363 | 1373 | | |
1364 | 1374 | | |
1365 | 1375 | | |
1366 | 1376 | | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1367 | 1381 | | |
1368 | 1382 | | |
1369 | 1383 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
435 | 451 | | |
0 commit comments