Skip to content

BigQuery: Only load table metadata when dropping with purge#16885

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/bigquery-droptable-purge-parity
Open

BigQuery: Only load table metadata when dropping with purge#16885
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/bigquery-droptable-purge-parity

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Summary

  • BigQueryMetastoreCatalog.dropTable always called ops.current() before checking purge.
  • The first ops.current() triggers doRefresh() -> client.load() (a BigQuery tables.get call) plus a metadata file read.
  • For a plain drop (purge=false) that load is wasted, since lastMetadata is only used when purging data.
  • Load the metadata only when purge is true, tolerating a NotFoundException by continuing the drop without purge.
  • This matches GlueCatalog.dropTable and HiveCatalog.dropTable, which already guard the load behind purge.

Testing done

  • Added TestBigQueryTableOperations#dropTableWithoutPurgeDoesNotLoadMetadata asserting verify(client, never()).load(...) for a plain drop.
  • Added TestBigQueryTableOperations#dropTableWithPurgeLoadsMetadata asserting the metadata is still loaded when purge=true.
  • ./gradlew :iceberg-bigquery:check — passed, 125 tests (0 failures, 23 pre-existing @Disabled skips); TestBigQueryTableOperations now has 10 tests.
  • REVAPI not applicable: iceberg-bigquery is not a REVAPI-published module.

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
@github-actions github-actions Bot added the GCP label Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant