-
Notifications
You must be signed in to change notification settings - Fork 201
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
Getting Original Schema of a DataFile in a FileScanTask? #401
Comments
@Fokko any thoughts? |
Hey @srilman sorry for not replying earlier. It slipped somewhere through the cracks, thanks for pinging me!
Unfortunately, no :(
A snapshot can have files with multiple schemas. See the example in duckdb/duckdb-iceberg#40
The only source of truth is in the Parquet file. The crux is that you don't want to do lookups based on names, but only on field field-IDs. Names can change over time, but field-id won't. So if you filter on a specific field-id, that will always work correctly. The same goes when reading parquet files, it can be that the names change over time, and you don't want to rewrite petabytes of data, so you can leave them as is. When reading, you want to make the field-ids to the current schema. |
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible. |
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale' |
Question
Is there a recommended way to getting the base / original schema or schema-id of a data file in a FileScanTask returned during
FileTableScan.plan_files
? This is useful to determine what kind of schema evolution occurred with the subset of files we are reading, and group files together with the same schemas for reads.I had a hard time accomplishing this in the Java library, but found it much easier to do in Python. In
plan_files
, we can get the snapshot id a data file was created by looking at thesnapshot_id
of the associated manifest entry (oradded_snapshot_id
of the manifest list if the previous is null). From there, we can get the associated schema per snapshot.Is this a logical approach, or is there a better way to get the original schema? Happy to open a PR to integrate this into
FileTableScan
if it would be useful!The text was updated successfully, but these errors were encountered: