Abacn commented on code in PR #40119:
URL: https://github.com/apache/beam/pull/40119#discussion_r4540649857


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java:
##########
@@ -936,7 +955,19 @@ public static Row toBeamRow(Schema rowSchema, TableSchema 
bqSchema, TableRow jso
           long nanos = (micros % 1_000_000) * 1_000;
           return java.time.Instant.ofEpochSecond(seconds, nanos);
         } catch (NumberFormatException e) {
-          return java.time.Instant.parse(jsonBQString);
+          try {
+            return java.time.Instant.parse(jsonBQString);
+          } catch (DateTimeParseException e2) {
+            try {

Review Comment:
   Thanks for being persistent. Can we first check if the string contains a " 
T" then use HISTORICAL_STORAGE_API_TIMESTAMP_FORMATTER; otherwise if contains " 
" then use BIGQUERY_TIMESTAMP_MICROS_FORMATTER, to avoid nested try {}... which 
is generally an antipattern



-- 
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