Commit 3a67d86
authored
fix(concat): correct nullability inference (nullable only if all arguments nullable) (#19189)
Fixes #19171
### Problem
The `concat` scalar function currently reports its result as **always
nullable** at
planning/schema time. However, its **runtime semantics** are:
- `concat` ignores NULL inputs.
- The result becomes NULL **only if all input arguments are NULL**.
This mismatch causes incorrect nullability in inferred schemas and can
affect
optimizer behavior.
### What this PR does
Implements `return_field_from_args` for `ConcatFunc` so that:
1. The return `DataType` is derived using the existing `return_type`
logic.
2. The return field’s nullability is computed as:
(If there are no argument fields, the return is considered nullable
defensively.)
This aligns schema-time nullability with runtime behavior and matches
the
semantics used by other SQL engines.
### Tests
- All existing unit tests for `concat` pass.
- Parquet & CSV tests verified locally after initializing test
submodules.
- No behavior changes to runtime concatenation: only planner-side
metadata improved.
### Notes
If CI finds any compatibility adjustments required across DataFusion
crates,
I will update this PR accordingly.1 parent 02c647a commit 3a67d86
1 file changed
+63
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| |||
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| |||
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
234 | | - | |
| 243 | + | |
235 | 244 | | |
| 245 | + | |
| 246 | + | |
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
| |||
266 | 277 | | |
267 | 278 | | |
268 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
269 | 326 | | |
0 commit comments