-
Notifications
You must be signed in to change notification settings - Fork 344
feat(core): Add support for _file column
#1824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gbrgr
wants to merge
14
commits into
apache:main
Choose a base branch
from
RelationalAI:feature/gb/file-column
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+668
−14
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vustef
reviewed
Nov 4, 2025
| /// // Select regular columns along with the file path | ||
| /// let scan = table | ||
| /// .scan() | ||
| /// .select(["id", "name", RESERVED_COL_NAME_FILE]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we ask for _file column without having to explicitly list all the other columns? E.g. get me all columns + _file. There should be some shortcut for this.
vustef
reviewed
Nov 4, 2025
_file column_file column
…erg-rust into feature/gb/file-column
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
_filemetadata column #1766.What changes are included in this PR?
This PR adds support for the
_filereserved column in Iceberg table scans, allowing users to retrieve the file path for each row in their query results. This is useful for debugging, auditing, and tracking data lineage.Core Implementation
Reserved column constants (reader.rs):
RESERVED_FIELD_ID_FILE = 2147483646- reserved field ID per Iceberg specRESERVED_COL_NAME_FILE = "_file"- column name per Iceberg specPublic API (scan/mod.rs):
RESERVED_COL_NAME_FILEas a public constant in theiceberg::scanmoduleKey Features
["col1", "_file", "col2"], the_filecolumn appears in the correct position (second)Usage Example
Are these changes tested?
Yes, comprehensive tests have been added to verify the functionality:
New Tests (9 tests added)
Table Scan API Tests (7 tests)
test_select_with_file_column- Verifies basic functionality of selecting_filewith regular columnstest_select_file_column_position- Verifies column ordering is preservedtest_select_file_column_only- Tests selecting only the_filecolumntest_file_column_with_multiple_files- Tests multiple data files scenariotest_file_column_at_start- Tests_fileat position 0test_file_column_at_end- Tests_fileat the last positiontest_select_with_repeated_column_names- Tests repeated column selectionArrow Reader Helper Tests (2 tests)
test_add_file_path_column_ree- Tests theadd_file_path_column_ree_at_position()helpertest_add_file_path_column_ree_empty_batch- Tests empty batch handling