claudevdm commented on code in PR #37091:
URL: https://github.com/apache/beam/pull/37091#discussion_r2642157715


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java:
##########
@@ -1060,6 +1091,25 @@ private static void fieldDescriptorFromTableField(
         fieldDescriptorBuilder =
             
fieldDescriptorBuilder.setType(Type.TYPE_MESSAGE).setTypeName(nested.getName());
         break;
+      case TIMESTAMP:
+        if (fieldSchema.getTimestampPrecision().getValue() == 
PICOSECOND_PRECISION) {
+          boolean typeAlreadyExists =
+              descriptorBuilder.getNestedTypeList().stream()
+                  .anyMatch(d -> 
TIMESTAMP_PICOS_DESCRIPTOR_PROTO.getName().equals(d.getName()));
+
+          if (!typeAlreadyExists) {
+            descriptorBuilder.addNestedType(TIMESTAMP_PICOS_DESCRIPTOR_PROTO);
+          }
+          fieldDescriptorBuilder =
+              fieldDescriptorBuilder
+                  .setType(Type.TYPE_MESSAGE)
+                  .setTypeName(TIMESTAMP_PICOS_DESCRIPTOR_PROTO.getName());
+        } else {
+          // Microsecond precision - use simple INT64

Review Comment:
   No, timestamp precision can only be null/6 or 12. Nanosecond is just a 
TIMESTAMP(12) with zero padding.



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