You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/11/10 07:56:25 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #34495: [SPARK-36182][SQL] Support TimestampNTZ type in Parquet data source
cloud-fan commented on a change in pull request #34495:
URL: https://github.com/apache/spark/pull/34495#discussion_r746323577
##########
File path: sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/ParquetVectorUpdaterFactory.java
##########
@@ -179,6 +183,21 @@ boolean isTimestampTypeMatched(LogicalTypeAnnotation.TimeUnit unit) {
((TimestampLogicalTypeAnnotation) logicalTypeAnnotation).getUnit() == unit;
}
+ void validateTimestampType(DataType sparkType) {
+ assert(logicalTypeAnnotation instanceof TimestampLogicalTypeAnnotation);
+ // Throw an exception if the Parquet type is TimestampLTZ and the Catalyst type is TimestampNTZ.
+ // This is to avoid mistakes in reading the timestamp values.
+ if (((TimestampLogicalTypeAnnotation) logicalTypeAnnotation).isAdjustedToUTC() &&
+ sparkType == DataTypes.TimestampNTZType) {
+ convertErrorForTimestampNTZ("int64 time(" + logicalTypeAnnotation + ")");
+ }
+ }
+
+ void convertErrorForTimestampNTZ(String parquetType) {
+ throw new RuntimeException("Unable to create Parquet converter for data type " +
+ DataTypes.TimestampNTZType.json() + " whose Parquet type is " + parquetType);
Review comment:
can we use the SQL format? `TIMESTAMP WITHOUT TIMEZONE`
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org