damccorm commented on code in PR #36068:
URL: https://github.com/apache/beam/pull/36068#discussion_r2330441004


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpers.java:
##########
@@ -281,6 +283,21 @@ boolean pollJob() throws IOException {
     boolean shouldRetry() {
       return currentAttempt < maxRetries + 1;
     }
+
+    void logBigQueryError(@Nullable Job job) {
+      if (job == null || !parseStatus(job).equals(Status.FAILED)) {
+        return;
+      }
+
+      List<ErrorProto> jobErrors = job.getStatus().getErrors();
+      String finalError = job.getStatus().getErrorResult().getMessage();
+      String causativeError =
+          jobErrors != null && !jobErrors.isEmpty()
+              ? String.format(" due to: %s", jobErrors.get(jobErrors.size() - 
1).getMessage())
+              : "";
+
+      LOG.error(String.format("BigQuery Error : %s %s", finalError, 
causativeError));
+    }

Review Comment:
   The null issues called out here aren't real, these methods all return 
non-null results.
   
   The efficiency piece doesn't matter in the failure condition, and the 
formatting should be fine



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to