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


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsTableStateOptions.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.connector.catalog;
+
+import java.util.Set;
+
+import org.apache.spark.annotation.Evolving;
+
+/**
+ * A catalog capability for identifying options that select a table's state.
+ * <p>
+ * Spark may resolve the same table more than once while analyzing or 
refreshing one query. A
+ * catalog can implement this interface to declare which raw read options may 
cause
+ * {@link TableCatalog#loadTable(Identifier, TableContext,
+ * org.apache.spark.sql.util.CaseInsensitiveStringMap)} to select a different 
table state, such as
+ * a branch, tag, snapshot, or version. Spark can then reuse one concrete 
{@link Table} instance
+ * for references whose table-state options match while preserving every 
reference's complete
+ * option map for scan planning.
+ * <p>
+ * Option key matching is case-insensitive. Option values remain 
case-sensitive. Parsed Spark time
+ * travel is handled independently and must not be included in the returned 
set.
+ * <p>
+ * Catalogs that do not implement this capability are handled conservatively: 
Spark treats every

Review Comment:
   Had some offline discussion on this and post here for posterity: making the 
default behavior to consider all options as table state option could prevent 
accidental correctness issue when options can dictate different table versions, 
but this introduced 2 problems:
   - this will make all DSV2 connectors not implementing the interface to start 
missing cache when options are stated differently, causing performance problem
   - it will break the table pinning behavior within one query when the table 
was specified twice with different options, and this could potentially result 
in correctness concern
   



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