mihailoale-db commented on code in PR #50325:
URL: https://github.com/apache/spark/pull/50325#discussion_r2011857072


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveIdentifierClause.scala:
##########
@@ -34,15 +38,75 @@ class ResolveIdentifierClause(earlyBatches: 
Seq[RuleExecutor[LogicalPlan]#Batch]
     override def batches: Seq[Batch] = earlyBatches.asInstanceOf[Seq[Batch]]
   }
 
-  override def apply(plan: LogicalPlan): LogicalPlan = 
plan.resolveOperatorsUpWithPruning(
-    _.containsPattern(UNRESOLVED_IDENTIFIER)) {
-    case p: PlanWithUnresolvedIdentifier if p.identifierExpr.resolved && 
p.childrenResolved =>
-      
executor.execute(p.planBuilder.apply(evalIdentifierExpr(p.identifierExpr), 
p.children))
-    case other =>
-      
other.transformExpressionsWithPruning(_.containsAnyPattern(UNRESOLVED_IDENTIFIER))
 {
-        case e: ExpressionWithUnresolvedIdentifier if 
e.identifierExpr.resolved =>
-          e.exprBuilder.apply(evalIdentifierExpr(e.identifierExpr), 
e.otherExprs)
-      }
+  override def apply(plan: LogicalPlan): LogicalPlan = {
+    val referredTempVars = new mutable.ArrayBuffer[Seq[String]]
+
+    plan match {
+      case createView: CreateView =>
+        if (conf.getConf(SQLConf.VARIABLES_UNDER_IDENTIFIER_IN_VIEW)) {
+          apply0(createView)
+        } else {
+          val analyzedChild = apply0(createView.child)
+          val analyzedQuery = apply0(createView.query, Some(referredTempVars))
+          if (referredTempVars.nonEmpty) {
+            throw 
QueryCompilationErrors.notAllowedToCreatePermanentViewByReferencingTempVarError(
+              Seq("PERSISTED"),

Review Comment:
   Sure.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to