yyanyy commented on code in PR #57582:
URL: https://github.com/apache/spark/pull/57582#discussion_r3687153489


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableCatalog.java:
##########
@@ -194,6 +194,46 @@ default Table loadTable(Identifier ident, long timestamp) 
throws NoSuchTableExce
     throw QueryCompilationErrors.noSuchTableError(name(), ident);
   }
 
+  /**
+   * Load table metadata by {@link Identifier identifier} from the catalog, 
forwarding all
+   * user-specified options.
+   * <p>
+   * The default implementation ignores {@code options} and delegates to the 
existing
+   * {@code loadTable} overloads based on {@code context}: {@link 
#loadTable(Identifier, String)}
+   * or {@link #loadTable(Identifier, long)} when time travel is present,
+   * {@link #loadTable(Identifier, Set)} when write privileges are present, 
otherwise
+   * {@link #loadTable(Identifier)}. Catalogs that want to receive the user 
options while reading a
+   * table (e.g. to customize the scan) must override this method.
+   *
+   * @param ident a table identifier
+   * @param context the parsed load parameters (time travel, write privileges)
+   * @param options all options passed to the read, including any keys that 
are also parsed into
+   *                {@code context}
+   * @return the table's metadata
+   * @throws NoSuchTableException If the table doesn't exist
+   *
+   * @since 4.2.0
+   */
+  default Table loadTable(
+      Identifier ident,
+      TableContext context,
+      CaseInsensitiveStringMap options) throws NoSuchTableException {
+    if (context.timeTravel().isPresent()) {
+      TimeTravel timeTravel = context.timeTravel().get();
+      if (timeTravel instanceof TimeTravel.Version v) {

Review Comment:
   I think we also compile with java 17 that switch isn't available



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