Commit d6fd069
authored
[Iceberg] Support nested column paths in keep/drop configuration (#37516)
* [Iceberg] Support nested column paths in keep/drop configuration
This change fixes the validation logic in IcebergScanConfig to support
nested column paths using dot notation (e.g., "data.name").
Previously, the validation only checked top-level column names, causing
nested paths like "colA.colB" to fail with "unknown field(s)" error.
The fix uses Iceberg's Schema.findField() which natively resolves
dot-notation paths for nested fields.
Fixes #37486
* [Iceberg] Also fix drop functionality for nested column paths
- Use TypeUtil.indexByName() to enumerate all field paths
- Only select leaf fields to prevent parent struct from including dropped children
- Add test for nested drop validation
* Apply Spotless formatting
* Rework nested column pruning to match Beam code style
- Replace inline fully-qualified names with proper imports
- Use TypeUtil.indexNameById (canonical paths only) instead of
indexByName (which includes short aliases that break drop logic)
- Remove verbose line-by-line comments
- Consolidate tests into a single method using sameSchema() assertions
to match the existing testProjectedSchema() pattern1 parent b2e97de commit d6fd069
2 files changed
Lines changed: 43 additions & 7 deletions
File tree
- sdks/java/io/iceberg/src
- main/java/org/apache/beam/sdk/io/iceberg
- test/java/org/apache/beam/sdk/io/iceberg
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
327 | 333 | | |
328 | 334 | | |
329 | 335 | | |
330 | | - | |
| 336 | + | |
331 | 337 | | |
332 | 338 | | |
333 | 339 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 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 | + | |
276 | 306 | | |
277 | 307 | | |
278 | 308 | | |
| |||
0 commit comments