[ 
https://issues.apache.org/jira/browse/BEAM-10655?focusedWorklogId=656282&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-656282
 ]

ASF GitHub Bot logged work on BEAM-10655:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Sep/21 17:52
            Start Date: 28/Sep/21 17:52
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on a change in pull request 
#15485:
URL: https://github.com/apache/beam/pull/15485#discussion_r717829804



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryUtils.java
##########
@@ -551,9 +548,9 @@ public static TableRow toTableRow(Row row) {
         return toTableRow((Row) fieldValue);
 
       case DATETIME:
-        return ((Instant) fieldValue)
-            .toDateTime(DateTimeZone.UTC)
-            .toString(BIGQUERY_TIMESTAMP_PRINTER);
+        org.joda.time.Instant jodaInstant = (org.joda.time.Instant) fieldValue;
+        java.time.Instant javaInstant = 
java.time.Instant.ofEpochMilli(jodaInstant.getMillis());
+        return BIGQUERY_TIMESTAMP_PRINTER.format(javaInstant);

Review comment:
       (FYI I edited your message, you said DATETIME/joda Instant was limited 
to microseconds, but I think you meant milliseconds)
   
   You're right this is an improvement over the existing solution (converting 
NanosInstant to DATETIME with millisecond precision), because it gets the full 
supported microsecond precision into BigQuery. But there is an advantage with 
the existing solution: the user has to opt-in to the truncation, by converting 
to DATETIME. I feel strongly that we shouldn't be truncating implicitly, and if 
we're doing that elsewhere I'd consider it a bug. Perhaps another reviewer 
would feel differently, but that is my position.
   
   That being said, you make a fair point that adding an option may be more 
work than you want to take on. Would it be a reasonable compromise to make this 
PR use the "erroring" approach, and file a follow-up ticket to add an option 
for truncation?
   
   




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 656282)
    Time Spent: 2h  (was: 1h 50m)

> Cannot write "google.protobuf.Timestamp" (NanosInstant) to BigQuery through 
> schemas
> -----------------------------------------------------------------------------------
>
>                 Key: BEAM-10655
>                 URL: https://issues.apache.org/jira/browse/BEAM-10655
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-gcp
>            Reporter: Chamikara Madhusanka Jayalath
>            Assignee: Xinshen Yong
>            Priority: P2
>              Labels: starter
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> See here for details and instructions for reproducing.
> [https://lists.apache.org/thread.html/r1657ccf41dda3f2d9d082c5ebb006dd2da92863983971ad23485f16e%40%3Cdev.beam.apache.org%3E]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to