TheNeuralBit commented on code in PR #22561:
URL: https://github.com/apache/beam/pull/22561#discussion_r941600714


##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcUtil.java:
##########
@@ -189,6 +190,18 @@ static JdbcIO.PreparedStatementSetCaller 
getPreparedStatementSetCaller(
           }
 
           String logicalTypeName = fieldType.getLogicalType().getIdentifier();
+
+          if (logicalTypeName.equals(MicrosInstant.IDENTIFIER)) {
+            // Process timestamp of MicrosInstant kind, which should only be 
passed from other type
+            // systems such as SQL and other Beam SDKs.
+            return (element, ps, i, fieldWithIndex) -> {
+              // MicrosInstant uses native java.time.Instant instead of 
joda.Instant.
+              java.time.Instant value =
+                  element.getLogicalTypeValue(fieldWithIndex.getIndex(), 
java.time.Instant.class);
+              ps.setTimestamp(i + 1, value == null ? null : new 
Timestamp(value.toEpochMilli()));

Review Comment:
   Ah ok, my mistake. Regardless there's no action needed here, I was just 
lamenting that this date/time type situation is messy.



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