@@ -198,6 +198,7 @@ private SQLReadResult readInternal(SQLReadRequest readRequest,
198
198
destinationDatasetId .getDataset (), destDataset .getLocation ());
199
199
return SQLReadResult .unsupported (datasetName );
200
200
}
201
+ String jobLocation = srcDataset .getLocation ();
201
202
202
203
Table sourceTable ;
203
204
try {
@@ -221,7 +222,7 @@ private SQLReadResult readInternal(SQLReadRequest readRequest,
221
222
// TRY SNAPSHOT
222
223
JobConfiguration jobConfiguration = getBQSnapshotJobConf (sourceTableId , destinationTableId );
223
224
SQLReadResult snapshotResult = executeBigQueryJob (jobConfiguration , sourceTable , sourceTableId ,
224
- BigQueryJobType .COPY_SNAPSHOT );
225
+ BigQueryJobType .COPY_SNAPSHOT , jobLocation );
225
226
if (snapshotResult .isSuccessful ()) {
226
227
BigQuerySQLEngineUtils .updateTableExpiration (bigQuery , destinationTableId , tableTTL );
227
228
return snapshotResult ;
@@ -236,18 +237,19 @@ private SQLReadResult readInternal(SQLReadRequest readRequest,
236
237
sourceConfig .getPartitionTo (),
237
238
tableTTL );
238
239
239
- return executeBigQueryJob (queryConfig , sourceTable , sourceTableId , BigQueryJobType .QUERY );
240
+ return executeBigQueryJob (queryConfig , sourceTable , sourceTableId , BigQueryJobType .QUERY , jobLocation );
240
241
}
241
242
242
243
private SQLReadResult executeBigQueryJob (JobConfiguration jobConfiguration ,
243
244
Table sourceTable ,
244
245
TableId sourceTableId ,
245
- BigQueryJobType bigQueryJobType )
246
+ BigQueryJobType bigQueryJobType ,
247
+ String jobLocation )
246
248
throws InterruptedException {
247
249
// Create a job ID so that we can safely retry.
248
250
JobId bqJobId = JobId .newBuilder ()
249
251
.setJob (jobId )
250
- .setLocation (sqlEngineConfig . getLocation () )
252
+ .setLocation (jobLocation )
251
253
.setProject (sqlEngineConfig .getProject ())
252
254
.build ();
253
255
0 commit comments