pingzh opened a new pull request, #6827: URL: https://github.com/apache/datafusion-comet/pull/6827
[Open Codex thread](https://chatgpt.com/codex/open-app?codex_thread_id=01a0fa20-5387-7733-bc0c-d255cce78696) ## Which issue does this PR close? Closes #6482. ## Rationale for this change With case-insensitive analysis, Spark accepts `CASE WHEN q THEN named_struct('x', i) ELSE named_struct('X', i) END` and names the result field `x`. Native CASE WHEN chose the ELSE branch's name instead, making native `to_json` emit `{"X":7}` instead of `{"x":7}`. ## What changes are included in this PR? - Merge branch types from the first THEN through the remaining THEN branches, with ELSE last. Reuse IF's positional struct merge as `merge_branch_types`, retaining field names and combining nested nullability without matching fields by name. - Keep casts for differing branch types. The synthetic timezone regression now expects the first THEN's label when present, consistent with IF; normal Comet timestamp inputs remain UTC. - Move the existing Rust unit tests into `case_when/tests.rs` and extend the existing struct checks to cover CASE WHEN as well as IF. ## How are these changes tested? - Add native SQL regressions for both field-name casing orders, multiple WHEN branches, omitted ELSE, and positional INT/DOUBLE struct fields. Native `to_json` exposes names that ordinary row comparison ignores. - Rust checks cover complete Arrow types, nullability, values, and mixed/all-THEN/all-ELSE batches. - Two independent source reviews completed. Rust formatting and `git diff --check` passed; no pre-commit hook is installed. - Local tests were not run. Runtime validation is pending CI; the Spark SQL suite should also run with `run-spark-4.1-tests` before this leaves draft. -- 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]
