cloud-fan commented on a change in pull request #34495:
URL: https://github.com/apache/spark/pull/34495#discussion_r746325937
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetRowConverter.scala
##########
@@ -370,6 +370,31 @@ private[parquet] class ParquetRowConverter(
}
}
+ // The converter doesn't support the TimestampLTZ Parquet type and
TimestampNTZ Catalyst type.
+ // This is to avoid mistakes in reading the timestamp values.
+ case TimestampNTZType
+ if parquetType.asPrimitiveType().getPrimitiveTypeName == INT64 &&
+
parquetType.getLogicalTypeAnnotation.isInstanceOf[TimestampLogicalTypeAnnotation]
&&
+ !parquetType.getLogicalTypeAnnotation
+ .asInstanceOf[TimestampLogicalTypeAnnotation].isAdjustedToUTC &&
+ parquetType.getLogicalTypeAnnotation
+ .asInstanceOf[TimestampLogicalTypeAnnotation].getUnit ==
TimeUnit.MICROS =>
Review comment:
shall we have a method to return an optional timestamp unit? then we can
shorten this very long condition.
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetQuerySuite.scala
##########
@@ -158,6 +158,71 @@ abstract class ParquetQuerySuite extends QueryTest with
ParquetTest with SharedS
}
}
+ test("SPARK-36182: writing and reading TimestampNTZType column") {
+ withTable("ts") {
+ sql("create table ts (c1 timestamp_ntz) using parquet")
Review comment:
can we test that we can not insert ltz into a ntz column?
--
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]