Repository navigation
Commit 519e4c5
authored
fix: propagate CASE unparser errors (apache#26311)
## Which issue does this PR close?
- Closes apache#26295.
## Rationale for this change
When a simple CASE operand or ELSE branch cannot be unparsed, the
unparser currently drops that child and returns valid-looking SQL with
different semantics. Callers should receive the original unparse error
instead.
## What changes are included in this PR?
Propagate errors from CASE operands and ELSE branches, matching the
existing WHEN/THEN behavior. Add regression coverage for both paths.
## What is the testing strategy for this PR?
- `cargo test -p datafusion-sql --lib` (95 passed)
- `cargo clippy -p datafusion-sql --all-targets --all-features -- -D
warnings`
- `cargo fmt --all --check`
The regression test was also run against the pre-fix implementation and
failed because unparsing returned a CASE AST instead of an error.
## Are there any user-facing changes?
Yes. CASE expressions with unsupported operands or ELSE branches now
return an error instead of producing SQL with altered semantics.1 parent c52eb97 commit 519e4c5
1 file changed
Lines changed: 30 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
263 | 257 | | |
264 | 258 | | |
265 | 259 | | |
| |||
3453 | 3447 | | |
3454 | 3448 | | |
3455 | 3449 | | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
3456 | 3472 | | |
3457 | 3473 | | |
3458 | 3474 | | |
| |||
0 commit comments