fix: Iceberg warehouse path mismatch between Python and Java/Scala catalogs#4409
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an Iceberg interoperability bug where Python-created tables could not be read by the Java/Scala engine due to a mismatched Postgres JDBC catalog warehouse value.
Changes:
- Align PyIceberg
SqlCatalogwarehouseconfiguration with the Java/ScalaJdbcCatalogby removing thefile://prefix. - Ensure Iceberg table metadata written from Python uses the same warehouse string the Scala side expects.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
What changes were proposed in this PR?
Iceberg tables created via the Python API could not be read back on the Java/Scala side because the two runtimes were registering the Postgres JDBC catalog with different warehouse values, which PyIceberg persists into the table metadata.
The Python side (create_postgres_catalog in amber/src/main/python/core/storage/iceberg/iceberg_utils.py) was prefixing the same path with file://, so tables created by Python UDFs were registered under file:///... while Scala-side lookups expected the un-prefixed path.
This caused subsequent reads of Python-written Iceberg tables to fail (wrong/unresolvable warehouse path in the metadata pointer).
Drop the file:// prefix in create_postgres_catalog so Python matches the Scala catalog's warehouse value exactly. PyIceberg accepts a plain local path here and will treat it as a local filesystem warehouse, consistent with the Scala JdbcCatalog configuration.
Any related issues, documentation, discussions?
Closes #4408
How was this PR tested?
Added a test case and tested manually:
Was this PR authored or co-authored using generative AI tooling?
No.