dusantism-db commented on code in PR #49993: URL: https://github.com/apache/spark/pull/49993#discussion_r1961488069
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala: ########## @@ -106,7 +107,12 @@ class SubstituteExecuteImmediate(val catalogManager: CatalogManager) override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsWithPruning(_.containsPattern(EXECUTE_IMMEDIATE), ruleId) { - case ExecuteImmediateQuery(expressions, query, targetVariables) => + case e @ ExecuteImmediateQuery(expressions, _, _) if expressions.exists(!_.resolved) => + e.copy(args = resolveArguments(expressions)) + + case ExecuteImmediateQuery(expressions, query, targetVariables) + if expressions.forall(_.resolved) => Review Comment: It is, i put the additional case to make it more explicit. For example if the order changes or the previous case is moved out of the rule (for example to `ResolveReferences`), this would still work properly. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/executeImmediate.scala: ########## @@ -106,7 +107,12 @@ class SubstituteExecuteImmediate(val catalogManager: CatalogManager) override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsWithPruning(_.containsPattern(EXECUTE_IMMEDIATE), ruleId) { - case ExecuteImmediateQuery(expressions, query, targetVariables) => + case e @ ExecuteImmediateQuery(expressions, _, _) if expressions.exists(!_.resolved) => + e.copy(args = resolveArguments(expressions)) + + case ExecuteImmediateQuery(expressions, query, targetVariables) + if expressions.forall(_.resolved) => Review Comment: It is, i put the additional case to make it more explicit / robust. For example if the order changes or the previous case is moved out of the rule (for example to `ResolveReferences`), this would still work properly. -- 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