rdblue commented on a change in pull request #25747: [SPARK-29039][SQL] 
centralize the catalog and table lookup logic
URL: https://github.com/apache/spark/pull/25747#discussion_r328844941
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveCatalogAndTables.scala
 ##########
 @@ -0,0 +1,119 @@
+/*
+ * 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.catalyst.analysis
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.catalyst.plans.logical.{AlterTable, 
DeleteFromTable, DescribeTable, LogicalPlan, SubqueryAlias}
+import 
org.apache.spark.sql.catalyst.plans.logical.sql.{AlterTableAddColumnsStatement, 
AlterTableAlterColumnStatement, AlterTableDropColumnsStatement, 
AlterTableRenameColumnStatement, AlterTableSetLocationStatement, 
AlterTableSetPropertiesStatement, AlterTableUnsetPropertiesStatement, 
AlterViewSetPropertiesStatement, AlterViewUnsetPropertiesStatement, 
DeleteFromStatement, DescribeColumnStatement, DescribeTableStatement, 
UpdateTableStatement}
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.connector.catalog.{CatalogManager, LookupCatalog, 
Table, TableChange, V1Table}
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
+
+/**
+ * Resolves catalogs and tables from the multi-part identifiers in SQL 
statements, and convert the
+ * statements to the corresponding v2 commands if the resolved table is not a 
[[V1Table]].
+ */
+class ResolveCatalogAndTables(val catalogManager: CatalogManager)
 
 Review comment:
   These steps must be done together only for v1 tables, and we already have 
rules that convert v1 tables separately. So the v1 table rules will need to 
look up the table before converting. I agree with you there. But when the 
catalog is any v2 catalog other than the session catalog, it will work to use 
UnresolvedRelation.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to