killme2008 opened a new pull request, #27160: URL: https://github.com/apache/datafusion/pull/27160
## Which issue does this PR close? Related: https://github.com/GreptimeTeam/datafusion/pull/38 ## Rationale for this change CASE expressions with literal WHEN values and nonliteral THEN expressions repeatedly copy unmatched rows, including string keys in partitioned join filters. ## What changes are included in this PR? Keep remaining row indices between branches and materialize selected rows for THEN/ELSE. Nonliteral WHEN expressions retain the existing path. Baseline `90b55e38b`, M4 Max/48 GiB, Rust 1.99.1, `release-nonlto`; 8,192 rows and two 32-byte string keys. Criterion: ABA/BAB/ABA, 20 samples, 0.5s warmup and 1s measurement per block; three-round means: | CASE distribution | main | This PR | Speedup | |---|---:|---:|---:| | Uniform, 1 branch | 16.665 µs | 16.616 µs | 1.003× | | Uniform, 4 branches | 224.073 µs | 149.591 µs | 1.498× | | Uniform, 16 branches | 418.237 µs | 225.284 µs | 1.856× | | First branch only, 4 branches | 16.560 µs | 16.597 µs | 0.998× | | First branch only, 16 branches | 16.803 µs | 16.692 µs | 1.007× | | 1 WHEN + ELSE, 50% match | 139.138 µs | 135.030 µs | 1.030× | Bracket drift stayed below 1.9% for uniform 4/16 branches and 50% match. Existing integer-column CASE measured 1.155× with 13.3% drift; unchanged lookup/no-base controls ranged from 0.995× to 1.012×. ## What is the testing strategy for this PR? The physical-expression regression preserves duplicate/NULL WHEN branches and error short-circuiting that SQL optimization can simplify. The benchmark checks output before timing. Extended workspace tests, 546 SQLLogicTest files, CLI tests, clippy and lint checks pass. ## Are there any user-facing changes? Performance only; SQL semantics and APIs are unchanged. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
