uros-b commented on code in PR #56407:
URL: https://github.com/apache/spark/pull/56407#discussion_r3419584339


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaConverter.scala:
##########
@@ -735,6 +746,15 @@ class SparkToParquetSchemaConverter(
       case TimestampNTZType =>
         Types.primitive(INT64, repetition)
           .as(LogicalTypeAnnotation.timestampType(false, 
TimeUnit.MICROS)).named(field.name)
+
+      case _: TimestampLTZNanosType =>
+        Types.primitive(INT64, repetition)
+          .as(LogicalTypeAnnotation.timestampType(true, 
TimeUnit.NANOS)).named(field.name)
+
+      case _: TimestampNTZNanosType =>
+        Types.primitive(INT64, repetition)
+          .as(LogicalTypeAnnotation.timestampType(false, 
TimeUnit.NANOS)).named(field.name)

Review Comment:
   It seems that the TimestampLTZNanosType and TimestampNTZNanosType cases have 
byte-for-byte identical bodies and guards. These two could collapse into one 
case, e.g.
   ```
   case (_: TimestampLTZNanosType | _: TimestampNTZNanosType) if 
isNanosTimestamp(parquetType) =>
   ...
   ```
   with the verbose annotation check extracted into a small predicate, 
mirroring the existing canReadAsTimestampNTZ helper.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to