Repository navigation
Commit a0e9887
authored
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes apache#23083
## Rationale for this change
`HashJoinExec` and `NestedLoopJoinExec` carry `projection:
Option<Vec<usize>>` but the proto field is `repeated uint32`. Proto3
can't tell `None` from `Some(vec![])`, and the decoder treats both as
`None`. `Some(vec![])` is reachable in real plans —
`try_embed_projection` produces it for `SELECT count(1) … JOIN …`
(apache#20191) — and after a round-trip the join silently switches from "emit
zero columns" to "emit all columns".
`FilterExec` has a workaround for the same limitation; these two execs
were missed.
## What changes are included in this PR?
Encode `Some(vec![])` as the single-element sentinel `[u32::MAX]` (never
a valid column index); recognise it on decode. Everything else goes
through unchanged.
```rust
// encode
projection: match exec.projection.as_ref() {
None => Vec::new(),
Some(v) if v.is_empty() => vec![u32::MAX],
Some(v) => v.iter().map(|x| *x as u32).collect(),
},
// decode
let projection = match hashjoin.projection.as_slice() {
[] => None,
[u32::MAX] => Some(Vec::new()),
indices => Some(indices.iter().map(|i| *i as usize).collect()),
};
```
Applied symmetrically to `HashJoinExec` and `NestedLoopJoinExec`.
## Are these changes tested?
yes, add roundtrip test case
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
1 parent 3bee970 commit a0e9887
2 files changed
Lines changed: 84 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1511 | 1510 | | |
1512 | 1511 | | |
1513 | 1512 | | |
| |||
1925 | 1924 | | |
1926 | 1925 | | |
1927 | 1926 | | |
1928 | | - | |
1929 | | - | |
1930 | | - | |
1931 | | - | |
1932 | | - | |
1933 | | - | |
1934 | | - | |
1935 | | - | |
1936 | | - | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
1937 | 1934 | | |
1938 | 1935 | | |
1939 | 1936 | | |
| |||
2658 | 2655 | | |
2659 | 2656 | | |
2660 | 2657 | | |
2661 | | - | |
2662 | | - | |
2663 | | - | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
2664 | 2666 | | |
2665 | 2667 | | |
2666 | 2668 | | |
| |||
3449 | 3451 | | |
3450 | 3452 | | |
3451 | 3453 | | |
3452 | | - | |
3453 | | - | |
3454 | | - | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
3455 | 3461 | | |
3456 | 3462 | | |
3457 | 3463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
419 | 472 | | |
420 | 473 | | |
421 | 474 | | |
| |||
0 commit comments