stevomitric commented on code in PR #58606:
URL: https://github.com/apache/spark/pull/58606#discussion_r4000134367


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala:
##########
@@ -287,6 +287,34 @@ class DataSourceV2MetadataViewSuite extends 
SharedSparkSession {
     }
   }
 
+  test("v2 CREATE / ALTER VIEW rejects a temporary variable read via an 
IDENTIFIER clause") {

Review Comment:
   added.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveIdentifierClause.scala:
##########
@@ -54,13 +56,36 @@ class ResolveIdentifierClause(earlyBatches: 
Seq[RuleExecutor[LogicalPlan]#Batch]
           }
           createView.copy(child = analyzedChild, query = analyzedQuery)
         }
+      // Same as [[CreateView]]: only the query body's IDENTIFIER-clause 
variables are dependencies
+      // of the view definition, so resolve the ALTER target without 
recording. Recording a variable
+      // used only to compute the target would, for a persisted view, be 
rejected by
+      // `verifyTemporaryObjectsNotExists`, and for a temporary view (which 
skips that validator) be
+      // persisted as a spurious dependency that breaks later reads.

Review Comment:
   reworded the comment. 



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