Repository navigation
[636] Load Iceberg source tables in Glue and HMS from metadata_location - #1061
Open
Indian-boult wants to merge 1 commit into
Open
Indian-boult wants to merge 1 commit into
Indian-boult wants to merge 1 commit into
Conversation
A metastore catalog such as AWS Glue or Hive keeps an Iceberg table's current metadata file in the metadata_location parameter and writes no version hint, so loading the table from its base path with HadoopTables failed every catalog sync of such a table. When the source table has no Iceberg catalog config and carries metadata_location, load the table read only from that metadata file.
This branch has not been deployed
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.
Fixes #636
Fixes #759
What is the purpose of the pull request
Catalog sync could not read an Iceberg source table registered in AWS Glue or Hive Metastore by an Iceberg catalog, such as a table created by Athena, Spark or Trino through
GlueCatalogorHiveCatalog. Those catalogs keep the current metadata file in the table'smetadata_locationparameter and write noversion-hint.text.GlueCatalogConversionSourceandHMSCatalogConversionSourcepass that parameter on in the source table's properties, butIcebergConversionSourceignored it and loaded the table from its base path withHadoopTables, which needs a version hint. Every such sync failed withNoSuchTableException: Table does not exist at location, which is the stack trace in #759.With this change, when a source table has no Iceberg catalog config and carries the catalog's
metadata_location, the Iceberg source loads the table read only from that metadata file, the same way Iceberg's own metastore catalogs resolve a table. A table with an Iceberg catalog config is still loaded through that catalog, and a table with neither is still loaded from its base path. Delta and Hudi sources are not affected.XTable's own Glue and HMS sync clients write the same
metadata_locationparameter for Iceberg targets, so the source side now reads the pointer the target side writes. The CLI exiting with 0 after this failure is tracked separately in #794 and #889 and is not changed here.Brief change log
IcebergConversionSourceloads the table from the catalog'smetadata_locationthroughStaticTableOperationswhen no Iceberg catalog config is set.TestIcebergTable.moveToMetastoreCatalogLayoutlays a test table out the way Glue and Hive keep it, with a metadata file named by sequence number and UUID and no version hint.TestIcebergConversionSource#testTableInMetastoreCatalogLoadsFromCatalogMetadataLocationreads such a table throughgetCurrentSnapshot,getCommitsBacklogandgetTableChangeForCommit, and checks that it cannot be found without the parameter.ITRunCatalogSync#testCatalogSyncOfIcebergTableInMetastoreCatalogrunsRunCatalogSyncwith a source catalog that builds the source table the wayGlueCatalogConversionSourcedoes, and checks the Delta table it writes. The class now runs its tests in one thread and the existing test counts only its own catalog calls, since both tests share the call counts ofTestCatalogSyncImpl.Verify this pull request
This change added tests and can be verified as follows:
IcebergConversionSource, the new unit test fails withNoSuchTableException: Table does not exist at location, and the new IT finds 0 records in the Delta target against 30 in the source../mvnw -pl xtable-core,xtable-utilities -am testpasses in every module, with 598 tests and 3 skipped in xtable-core.ITRunCatalogSync,ITIcebergConversionSourceandITConversionController#testVariousOperationspass, 39 tests in all.