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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Util.scala
##########
@@ -276,9 +277,23 @@ private[sql] object CatalogV2Util {
     new StructType(newFields)
   }
 
-  def loadTable(catalog: CatalogPlugin, ident: Identifier): Option[Table] =
+  def loadTable(
+      catalog: CatalogPlugin,
+      ident: Identifier,
+      timeTravelSpec: Option[TimeTravelSpec] = None): Option[Table] =
     try {
-      Option(catalog.asTableCatalog.loadTable(ident))
+      if (timeTravelSpec.nonEmpty) {
+        timeTravelSpec.get match {
+          case v: AsOfVersion =>
+            Option(catalog.asTableCatalog.loadTable(ident, v.version))
+          case ts: AsOfTimestamp =>
+            Option(catalog.asTableCatalog.loadTable(ident, ts.timestamp))
+          case _ =>
+            Option(catalog.asTableCatalog.loadTable(ident))

Review comment:
       this should never happen. We can remove this default case and Scala 
compiler will still be happy, because `TimeTravelSpec` is a `sealed trait`




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