sotikoug83 commented on code in PR #56481:
URL: https://github.com/apache/spark/pull/56481#discussion_r3487891271
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala:
##########
@@ -2193,6 +2194,69 @@ class PlanParserSuite extends AnalysisTest {
stop = 38))
}
+ test("at syntax time travel") {
+ def versionPlan(version: String): LogicalPlan = {
+ Project(Seq(UnresolvedStar(None)),
+ RelationTimeTravel(UnresolvedRelation(Seq("a", "b", "c")), None,
Some(version)))
+ }
+ assertEqual("SELECT * FROM a.b.c@v123456789", versionPlan("123456789"))
+ assertEqual("SELECT * FROM a.b.c@V123456789", versionPlan("123456789"))
+ assertEqual("SELECT * FROM a.b.c @v123456789", versionPlan("123456789"))
+ assertEqual("SELECT * FROM a.b.c@v'Snapshot123456789'",
versionPlan("Snapshot123456789"))
+
+ val micros = DateTimeUtils.stringToTimestampAnsi(
+ UTF8String.fromString("2019-01-29 00:37:58"),
+ DateTimeUtils.getZoneId(SQLConf.get.sessionLocalTimeZone))
+ assertEqual("SELECT * FROM a.b.c@20190129003758000",
+ Project(Seq(UnresolvedStar(None)),
+ RelationTimeTravel(
+ UnresolvedRelation(Seq("a", "b", "c")),
+ Some(Literal(micros, TimestampType)),
+ None)))
+
+ assertEqual("SELECT * FROM `t@v1`",
+ Project(Seq(UnresolvedStar(None)), UnresolvedRelation(Seq("t@v1"))))
+
+ checkError(
+ exception = parseException("SELECT * FROM t@v1 VERSION AS OF 2"),
+ condition = "MULTIPLE_TIME_TRAVEL_SPEC",
+ parameters = Map.empty,
+ context = ExpectedContext(fragment = "VERSION AS OF 2", start = 19, stop
= 33))
+
+ checkError(
+ exception = parseException("SELECT * FROM t@123"),
+ condition = "INVALID_TIMESTAMP_FORMAT",
Review Comment:
Added tests for this.
--
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]