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_r354491038
 
 

 ##########
 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:
   Can you write to a temp view? Why is it valid for a temp view to be here?
   
   If I have a temp view `t1` and a table `default.t1` in and the current 
namespace is `default`, then what should `INSERT INTO t1 ...` do? It seems to 
me that it should insert into the table `default.t1` because it doesn't make 
sense to insert into the temp view.
   
   If that's the case, then temp views should never be resolved unless in a 
query.

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