cloud-fan commented on a change in pull request #34596: URL: https://github.com/apache/spark/pull/34596#discussion_r752896736
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala ########## @@ -1451,7 +1451,29 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper { } } } + } + test("to_timestamp_ntz fail to parse timestamp with timezone") { + val specialTs = Seq( + "0001-01-01T00:00:00", // the fist timestamp of Common Era + "1582-10-15T23:59:59", // the cutover date from Julian to Gregorian calendar + "1970-01-01T00:00:00", // the epoch timestamp + "9999-12-31T23:59:59" // the last supported timestamp according to SQL standard + ) + outstandingZoneIds.foreach { zoneId => + withDefaultTimeZone(zoneId) { + specialTs.foreach { s => + val input = s.replace("T", " ") + Seq(".123456PST", ".123456CST", ".123456UTC").foreach { segment => + val input2 = input + segment + checkExceptionInExpression[RuntimeException]( + GetTimestamp(Literal(input2), Literal("yyyy-MM-dd HH:mm:ss.SSSSSS[zzz]"), Review comment: what if the pattern string does not have the timezone part? do we still fail when parsing the string with 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org