rdblue commented on a change in pull request #26684: [SPARK-30001][SQL] 
ResolveRelations should handle both V1 and V2 tables.
URL: https://github.com/apache/spark/pull/26684#discussion_r354627788
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -777,36 +772,84 @@ class Analyzer(
     }
 
     def apply(plan: LogicalPlan): LogicalPlan = 
ResolveTables(plan).resolveOperatorsUp {
-      case i @ InsertIntoStatement(u @ 
UnresolvedRelation(AsTableIdentifier(ident)), _, child, _, _)
-          if child.resolved =>
-        EliminateSubqueryAliases(lookupTableFromCatalog(ident, u)) match {
+      case i @ InsertIntoStatement(
+          u @ UnresolvedRelation(CatalogObjectIdentifier(catalog, ident)), _, 
_, _, _)
+            if i.query.resolved && CatalogV2Util.isSessionCatalog(catalog) =>
+        val relation = ResolveTempViews(u) match {
 
 Review comment:
   Thanks! I think I would rather implement the check a different way:
   1. Don't resolve temp tables in ResolveRelations
   2. In CheckAnalysis (in catalyst), check for InsertInto(Unresolved(...)) and 
if the unresolved relation is a temp table state that it is a temp table and 
can't be resolved.
   
   It would be good to know what other databases do in this case because my 
suggestion to not resolve the identifier as a temp table would allow matching a 
table here if there is one that conflicts. Probably good to consider this case 
in the broader clean up of temp table handling.

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