gengliangwang commented on a change in pull request #33176: URL: https://github.com/apache/spark/pull/33176#discussion_r662480054
########## File path: sql/core/src/test/scala/org/apache/spark/sql/TimestampTypeSuite.scala ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.spark.sql + +import java.sql.Timestamp +import java.time.LocalDateTime + +import org.apache.spark.sql.internal.SQLConf +import org.apache.spark.sql.test.SharedSparkSession +import org.apache.spark.sql.types.{StructField, StructType, TimestampNTZType, TimestampType} +import org.apache.spark.util.ResetSystemProperties + +// Test suite for setting the default timestamp type of Spark SQL +class TimestampTypeSuite extends QueryTest with SharedSparkSession with ResetSystemProperties { Review comment: This is end-to-end test with actual queries, which can't be done in DataTypeSuite. I just renamed the file to `SetDefaultTimestampTypeSuite` to avoid the confusion. ########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala ########## @@ -2820,6 +2821,23 @@ object SQLConf { .booleanConf .createWithDefault(true) + object TimestampTypes extends Enumeration { + val TIMESTAMP_NTZ, TIMESTAMP_LTZ = Value + } + + val TIMESTAMP_TYPE = + buildConf("spark.sql.timestampType") + .doc("Configures the default timestamp type of Spark SQL, including SQL DDL and Cast " + + "clause. Setting the configuration as TIMESTAMP_NTZ will use TIMESTAMP WITHOUT TIME " + Review comment: Done. -- 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]
