Skip to content

[Iceberg] Support nested column paths in keep/drop configuration#37516

Open
PDGGK wants to merge 3 commits intoapache:masterfrom
PDGGK:fix-nested-column-pruning
Open

[Iceberg] Support nested column paths in keep/drop configuration#37516
PDGGK wants to merge 3 commits intoapache:masterfrom
PDGGK:fix-nested-column-pruning

Conversation

@PDGGK
Copy link
Contributor

@PDGGK PDGGK commented Feb 5, 2026

Summary

This PR enables support for nested column paths (dot notation) in both keep and drop configuration for Iceberg IO column pruning.

Problem:
Users cannot specify nested column paths like keep: ["data.name"] or drop: ["data.name"] - the validation fails with:

Invalid source configuration: 'keep' specifies unknown field(s): [data.name]

Solution:

  1. Validation fix: Replace top-level-only column validation with Schema.findField() which natively resolves dot-notation paths
  2. Drop fix: Use TypeUtil.indexByName() to enumerate all field paths (including nested), then select only leaf fields to prevent parent structs from implicitly including dropped children

Changes:

  • IcebergScanConfig.java:
    • Updated validate() method to use findField() for nested path support
    • Rewrote resolveSchema() drop logic to handle nested paths correctly
  • IcebergIOReadTest.java: Added test cases for nested column keep and drop

Fixes #37486

Test plan

  • Added testNestedColumnPruningValidation - verifies nested paths in keep are accepted
  • Added testNestedColumnDropValidation - verifies nested paths in drop work correctly
  • Existing tests should continue to pass

🤖 Generated with Claude Code

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 apache#37486
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @PDGGK, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Iceberg IO functionality by enabling users to specify nested column paths in the keep and drop configurations. This change improves the flexibility of column pruning and allows users to select specific nested fields within their Iceberg tables. The update includes a modification to the validation logic and the addition of a new test case to ensure the correct handling of nested column paths.

Highlights

  • Nested Column Support: This PR introduces support for specifying nested column paths (using dot notation) in the keep and drop configurations for Iceberg IO column pruning.
  • Validation Update: The validation logic in IcebergScanConfig.java has been updated to use Schema.findField() to resolve nested column paths, allowing for more flexible column selection.
  • New Test Case: A new test case, testNestedColumnPruningValidation, has been added to IcebergIOReadTest.java to verify that nested column paths are correctly handled.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • IcebergIOReadTest.java
    • Added a new test case, testNestedColumnPruningValidation, to verify nested column path validation.
  • IcebergScanConfig.java
    • Updated the validate() method to use findField() for resolving nested column paths.
Activity
  • The PR introduces support for nested column paths in Iceberg IO column pruning.
  • The validation logic in IcebergScanConfig.java is updated to use Schema.findField().
  • A new test case is added to verify the functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- 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
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@PDGGK
Copy link
Contributor Author

PDGGK commented Feb 6, 2026

The failing beam_PreCommit_Java check appears to be unrelated to this PR's changes - the failures are in FileIO, CountingSource, TFRecordIO tests while this PR only modifies IcebergScanConfig.java. Could a maintainer please re-run the failed check? /retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Enable Nested Column support in Column Pruning in Iceberg IO

1 participant