kennknowles commented on code in PR #36296:
URL: https://github.com/apache/beam/pull/36296#discussion_r2591170411


##########
sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformProvider.java:
##########
@@ -23,7 +23,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import java.util.Objects;

Review Comment:
   Unrelated file - just leave it



##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/WriteRename.java:
##########
@@ -329,14 +331,39 @@ private BigQueryHelpers.PendingJob startCopy(
             new EncryptionConfiguration().setKmsKeyName(kmsKey));
       }
 
-      String bqLocation =
-          BigQueryHelpers.getDatasetLocation(
-              datasetService, ref.getProjectId(), ref.getDatasetId());
+      String bqLocation;
+      try {

Review Comment:
   You've repeated this block in each place. Instead, it should be abstracted 
out. Or perhaps the exception should just be propagated. That is usually the 
right thing to do unless it absolutely must be converted into RuntimeException.



##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpers.java:
##########
@@ -632,20 +632,15 @@ static void verifyDatasetPresence(DatasetService 
datasetService, TableReference
   }
 
   static String getDatasetLocation(
-      DatasetService datasetService, String projectId, String datasetId) {
-    Dataset dataset;
+      DatasetService datasetService, String projectId, String datasetId)
+      throws IOException, InterruptedException {
     try {
-      dataset = datasetService.getDataset(projectId, datasetId);
-    } catch (Exception e) {
-      if (e instanceof InterruptedException) {
-        Thread.currentThread().interrupt();
-      }
-      throw new RuntimeException(
-          String.format(
-              "unable to obtain dataset for dataset %s in project %s", 
datasetId, projectId),
-          e);
+      Dataset dataset = datasetService.getDataset(projectId, datasetId);
+      return dataset.getLocation();
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();

Review Comment:
   Log here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to