Skip to content

Commit f97ae64

Browse files
committed
fix(bigquery): default Arrow pagination stream location to US instead of global
1 parent cc4b980 commit f97ae64

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,18 +379,19 @@ public Page<FieldValueList> getNextPage() {
379379
List<FieldValueList> rowBatch = new ArrayList<>((int) Math.min(pageSize, 10000L));
380380

381381
try {
382-
// Resolve job location in order: JobId location -> BigQueryOptions location -> "global"
382+
// Resolve job location in order: JobId location -> BigQueryOptions location -> "US"
383383
// default.
384384
// The Storage Read API stream resource name requires a location component (e.g.
385385
// projects/{project}/locations/{location}/jobs/{job}/streams/_default). If no specific
386-
// location was provided on the job or service options, defaulting to "global" allows
387-
// queries created without an explicit location to still stream results without failing.
386+
// location was provided on the job or service options, defaulting to "US" (the standard
387+
// BigQuery default multi-region) allows queries created without an explicit location
388+
// to stream results from default datasets without failing.
388389
String location = jobId.getLocation();
389390
if (location == null) {
390391
location = serviceOptions.getLocation();
391392
}
392393
if (location == null) {
393-
location = "global";
394+
location = "US";
394395
}
395396

396397
if (streamIterator == null) {

‎java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/ArrowQueryPageFetcherTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ void testGetNextPage_respectsMaxResults() throws IOException {
289289
}
290290

291291
@Test
292-
void testGetNextPage_missingLocationDefaultsToGlobal() throws IOException {
293-
byte[] batchBytes = createBatchBytes(ImmutableList.of(10L));
292+
void testGetNextPage_missingLocationDefaultsToUS() throws IOException {
293+
byte[] batchBytes = createBatchBytes(ImmutableList.of(1L));
294294
ReadRowsResponse response =
295295
ReadRowsResponse.newBuilder()
296296
.setArrowRecordBatch(
@@ -331,7 +331,7 @@ void testGetNextPage_missingLocationDefaultsToGlobal() throws IOException {
331331
Page<FieldValueList> page = fetcher.getNextPage();
332332
assertNotNull(page);
333333
assertEquals(
334-
"projects/" + PROJECT + "/locations/global/jobs/" + JOB + "/streams/_default",
334+
"projects/" + PROJECT + "/locations/US/jobs/" + JOB + "/streams/_default",
335335
requestCapture.getValue().getReadStream());
336336
}
337337

0 commit comments

Comments
 (0)