Skip to content

fix(bigquery-jdbc): explicitly set location when available for temporary dataset#13508

Open
Neenu1995 wants to merge 2 commits into
mainfrom
dataset-location-fix
Open

fix(bigquery-jdbc): explicitly set location when available for temporary dataset#13508
Neenu1995 wants to merge 2 commits into
mainfrom
dataset-location-fix

Conversation

@Neenu1995

@Neenu1995 Neenu1995 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

b/524850173

@Neenu1995 Neenu1995 requested review from a team as code owners June 17, 2026 17:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates BigQueryStatement to ensure that when a temporary dataset is created, its location is set to match the connection's location if specified. It also adds unit and integration tests to verify this behavior. The review feedback recommends wrapping the integration test cleanup in a try-catch block to prevent any deletion failures from masking the primary test failure.

if (this.connection != null
&& this.connection.getLocation() != null
&& !this.connection.getLocation().isEmpty()) {
datasetInfoBuilder.setLocation(this.connection.getLocation());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we don't need all these checks. connection can't be null & if Location is null, so be it.. SDK will handle null Location the same way as no location.

E.g. we do it in executeJob()

assertEquals(1, rs.getInt("val"));
}

Dataset dataset = bigQuery.getDataset(DatasetId.of(tempDatasetName));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we validate that this dataset actually has data? (e.g. ensure that it is indeed the dataset that was used to write results to). Might require larger query

@Neenu1995

Copy link
Copy Markdown
Contributor Author

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants