TheNeuralBit commented on a change in pull request #15485:
URL: https://github.com/apache/beam/pull/15485#discussion_r721585635
##########
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:
Yes `BigQueryIO.Write#allowTruncatedTimestamps()` sounds like a
reasonable addition to the public API of BigQuery. I might suggest
`withAllowTruncatedTimestamps()` to be consistent with other boolean
parameters, e.g.
[`withExtendedErrorInfo`](https://beam.apache.org/releases/javadoc/2.32.0/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.Write.html#withExtendedErrorInfo--).
@chamikaramj may be a better judge of what the public API should look like
though.
The reason I clarified my suggested default (non-truncating, error-raising)
behavior was just in case that behavior is acceptable for your use-case. If it
is then you could avoid creating the parameter for now if you want.
--
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]