Repository navigation
Commit 1c085c3
authored
perf: resolve aliased field once during metadata inference (apache#26156)
## Which issue does this PR close?
Related to apache#24264. This isolates the alias single-resolution
optimization from the broader, closed apache#24316.
## Rationale for this change
Deriving a field for nested aliases resolves each child twice: once
through `metadata()` and once through `to_field()`. Since `metadata()`
itself calls `to_field()`, the work grows exponentially with alias
depth. This affects schema inference and planning; no row execution path
changes.
## What changes are included in this PR?
Resolve the aliased child field once and read its metadata from that
same field before applying explicit alias metadata. A 12-level
regression test records 4,096 source-field lookups before the change and
one after it, while checking metadata override, preserved metadata,
output name, type, and nullability.
## What is the testing strategy for this PR?
- `cargo fmt --all --check`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion-expr --lib` (282 passed)
- Full documented extended workspace command with initialized test-data
submodules and Arrow/Parquet fixtures (passed)
- Independent read-only review: approved with no blocking findings.
## Are there any user-facing changes?
No schema or API behavior change; this reduces planning cost.1 parent d2bd93c commit 1c085c3
1 file changed
Lines changed: 59 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
| 540 | + | |
| 541 | + | |
541 | 542 | | |
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
| 546 | + | |
549 | 547 | | |
550 | 548 | | |
551 | 549 | | |
| |||
1286 | 1284 | | |
1287 | 1285 | | |
1288 | 1286 | | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
1289 | 1343 | | |
1290 | 1344 | | |
1291 | 1345 | | |
| |||
0 commit comments