Indian-boult opened a new pull request, #1061: URL: https://github.com/apache/incubator-xtable/pull/1061
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 `GlueCatalog` or `HiveCatalog`. Those catalogs keep the current metadata file in the table's `metadata_location` parameter and write no `version-hint.text`. `GlueCatalogConversionSource` and `HMSCatalogConversionSource` pass that parameter on in the source table's properties, but `IcebergConversionSource` ignored it and loaded the table from its base path with `HadoopTables`, which needs a version hint. Every such sync failed with `NoSuchTableException: 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_location` parameter 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 - `IcebergConversionSource` loads the table from the catalog's `metadata_location` through `StaticTableOperations` when no Iceberg catalog config is set. - `TestIcebergTable.moveToMetastoreCatalogLayout` lays 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#testTableInMetastoreCatalogLoadsFromCatalogMetadataLocation` reads such a table through `getCurrentSnapshot`, `getCommitsBacklog` and `getTableChangeForCommit`, and checks that it cannot be found without the parameter. - `ITRunCatalogSync#testCatalogSyncOfIcebergTableInMetastoreCatalog` runs `RunCatalogSync` with a source catalog that builds the source table the way `GlueCatalogConversionSource` does, 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 of `TestCatalogSyncImpl`. ## Verify this pull request This change added tests and can be verified as follows: - Without the change in `IcebergConversionSource`, the new unit test fails with `NoSuchTableException: Table does not exist at location`, and the new IT finds 0 records in the Delta target against 30 in the source. - With the change, both pass. - `./mvnw -pl xtable-core,xtable-utilities -am test` passes in every module, with 598 tests and 3 skipped in xtable-core. - `ITRunCatalogSync`, `ITIcebergConversionSource` and `ITConversionController#testVariousOperations` pass, 39 tests in all. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
