cloud-fan commented on a change in pull request #34497:
URL: https://github.com/apache/spark/pull/34497#discussion_r749379622



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala
##########
@@ -357,3 +360,35 @@ private[sql] object SortValue {
       None
   }
 }
+
+private[sql] sealed trait TimeTravelSpec
+
+private[sql] case class AsOfTimestamp(timestamp: Long) extends TimeTravelSpec
+private[sql] case class AsOfVersion(version: String) extends TimeTravelSpec
+
+private[sql] object TimeTravelSpec {
+  def create(timestamp: Option[String], version: Option[String]) : 
Option[TimeTravelSpec] = {
+    if (timestamp.nonEmpty && version.nonEmpty) {
+      throw new IllegalArgumentException(
+        "Version and Timestamp can't both be set in TimeTravelSpec")
+    } else if (timestamp.nonEmpty) {
+      val timeZoneId = 
DateTimeUtils.parseTimestampString(UTF8String.fromString(timestamp.get))._2

Review comment:
       We can simply do
   ```
   val us = DateTimeUtils.stringToTimestampAnsi(
     UTF8String.fromString(timestamp.get),
     DateTimeUtils.getZoneId(SQLConf.get.sessionLocalTimeZone))
   ```
   
   If you look at the code, it respects the zone id in the input string.




-- 
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]

Reply via email to