You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/05/31 21:59:52 UTC

[GitHub] [beam] reuvenlax commented on a diff in pull request #17778: [Beam-14528]: Add ISO time format support for Timestamp, Date, DateTime, Time field.

reuvenlax commented on code in PR #17778:
URL: https://github.com/apache/beam/pull/17778#discussion_r886162205


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java:
##########
@@ -370,10 +376,20 @@ static Object singularFieldToProtoValue(
       case "TIMESTAMP":
         if (value instanceof String) {
           try {
-            return ChronoUnit.MICROS.between(Instant.EPOCH, Instant.parse((String) value));
-          } catch (DateTimeParseException e) {
-            return ChronoUnit.MICROS.between(
+            // "12345667"
+            ChronoUnit.MICROS.between(

Review Comment:
   Seems like the formatted datetime would be the more-common case, right? If so, then we should probably try to parse using the DateTimeFormatter first.



-- 
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-unsubscribe@beam.apache.org

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