Repository navigation
Conversation
Incorporate deferred CASE/UNION coercion errors, dictionary coercion from actual inputs, and an empty-input guard, informed by: apache#27139 Keep regression coverage in SQL and document the dictionary output-type change for UNION BY NAME.
|
@kumarUjjawal @alamb PTAL |
|
run benchmark sql_planner sql_planner_extended |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/case-union-schema-draft (21290b2) to 70f2ed0 (merge-base) diff Run configurationrun benchmark sql_planner_extendedResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/case-union-schema-draft (21290b2) to 70f2ed0 (merge-base) diff Run configurationrun benchmark sql_plannerResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/case-union-schema-draft (21290b2) to 70f2ed0 (merge-base) diff Run configurationrun benchmark sql_planner_extendedCPU Details (lscpu)Details
Resource Usagesql_planner_extended — base (merge-base)
sql_planner_extended — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/case-union-schema-draft (21290b2) to 70f2ed0 (merge-base) diff Run configurationrun benchmark sql_plannerCPU Details (lscpu)Details
Resource Usagesql_planner — base (merge-base)
sql_planner — branch
File an issue against this benchmark runner |
Which issue does this PR close?
Addresses #27023. Related to #14380.
Draft alternative to #27139 by @kumarUjjawal, incorporating its dictionary coercion, deferred-error, and empty-input handling ideas. This version also refreshes UNION schemas after untyped parameter binding and keeps regression coverage in SQL.
Rationale for this change
Before analysis,
DataFrame::schema()can report the first UNION input's type while execution returns a wider common type. CASE similarly overlooks wider later result branches. Infer the common output types early so callers see the expected schema.What changes are included in this PR?
coerce_union_schema.Input casts remain deferred to the analyzer, so this does not fully resolve #14380.
What is the testing strategy for this PR?
Added checks in
case.slt,union.slt, andunion_by_name.sltcover pre-analysis schemas, all three type mismatches reported in #27023, deferred errors, and dictionary output types. Existing SLTs cover execution, including NVL/UNION.Local validation passed: 13,491 Rust tests, all 547 SLT files, all-target/all-feature Clippy, Rust and Markdown formatting. Temporary API checks verified untyped parameter binding and empty-input handling. All five UNION integration tests from #27139 also passed against this implementation without adding them to this PR.
A local synthetic nested CASE benchmark measured SQL through physical planning against upstream
b6b2e0e5d, using matching dependencies and optimizedci-benchbuilds (opt-level=1). Results are averages of two run medians; the parser recursion limit was raised equally in both builds.Deeply nested CASE inference adds measurable planning work; these measurements do not establish a general workload slowdown.
Are there any user-facing changes?
DataFrame::schema()andDESCRIBEreport inferred common types before analysis. Unsupported combinations remain deferred to analyzer coercion.With a missing
Dictionary(Int32, Utf8)column, UNION BY NAME now returnsUtf8in either input order. Previously, a missing left column preserved the dictionary representation. Values are unchanged; the upgrade note documents the schema compatibility change.