BigQuery: Only load table metadata when dropping with purge#16885
Open
thswlsqls wants to merge 1 commit into
Open
BigQuery: Only load table metadata when dropping with purge#16885thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
dropTable always called ops.current() before checking purge, which triggers a BigQuery tables.get plus a metadata file read on the first call to a fresh table ops. For a plain drop (purge=false) that remote load is wasted, since lastMetadata is only used when purging data. Load the metadata only when purge is true, matching GlueCatalog and HiveCatalog, and tolerate a NotFoundException there by continuing the drop without purge. Generated-by: Claude Code
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.
Summary
BigQueryMetastoreCatalog.dropTablealways calledops.current()before checkingpurge.ops.current()triggersdoRefresh()->client.load()(a BigQuerytables.getcall) plus a metadata file read.purge=false) that load is wasted, sincelastMetadatais only used when purging data.purgeis true, tolerating aNotFoundExceptionby continuing the drop without purge.GlueCatalog.dropTableandHiveCatalog.dropTable, which already guard the load behindpurge.Testing done
TestBigQueryTableOperations#dropTableWithoutPurgeDoesNotLoadMetadataassertingverify(client, never()).load(...)for a plain drop.TestBigQueryTableOperations#dropTableWithPurgeLoadsMetadataasserting the metadata is still loaded whenpurge=true../gradlew :iceberg-bigquery:check— passed, 125 tests (0 failures, 23 pre-existing@Disabledskips);TestBigQueryTableOperationsnow has 10 tests.iceberg-bigqueryis not a REVAPI-published module.