gengliangwang commented on a change in pull request #33215:
URL: https://github.com/apache/spark/pull/33215#discussion_r663837939
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -248,7 +248,7 @@ object DateTimeUtils {
* @return timestamp segments, time zone id and whether the input is just
time without a date. If
* the input string can't be parsed as timestamp, the result
timestamp segments are empty.
*/
- private def parseTimestampString(s: UTF8String): (Array[Int],
Option[ZoneId], Boolean) = {
+ private[sql] def parseTimestampString(s: UTF8String): (Array[Int],
Option[ZoneId], Boolean) = {
Review comment:
Done
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala
##########
@@ -463,6 +464,17 @@ class ExpressionParserSuite extends AnalysisTest {
Literal(Timestamp.valueOf("2016-03-11 20:54:00.000")))
intercept("timestamP '2016-33-11 20:54:00.000'", "Cannot parse the
TIMESTAMP value")
+ // Timestamp without time zone
+ withSQLConf(SQLConf.TIMESTAMP_TYPE.key ->
TimestampTypes.TIMESTAMP_NTZ.toString) {
+ assertEqual("tImEstAmp '2016-03-11 20:54:00.000'",
+ Literal(LocalDateTime.parse("2016-03-11T20:54:00.000")))
+
+ intercept("timestamP '2016-33-11 20:54:00.000'", "Cannot parse the
TIMESTAMP value")
+
+ // If the timestamp string contains time zone, return a timestamp with
local time zone literal
+ assertEqual("tImEstAmp '2019-01-16 20:50:00.567000+01:00'",
+ Literal(1547668200567000L, TimestampType))
Review comment:
Sure. It is from another test case in the same test suite.
--
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]