cloud-fan commented on code in PR #52173: URL: https://github.com/apache/spark/pull/52173#discussion_r2312769857
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala: ########## @@ -1157,20 +1156,16 @@ class AstBuilder extends DataTypeAstBuilder * }}} */ override def visitExecuteImmediate(ctx: ExecuteImmediateContext): LogicalPlan = withOrigin(ctx) { - // Because of how parsing rules are written, we know that either - // queryParam or targetVariable is non null - hence use Either to represent this. - val queryString = Option(ctx.queryParam.stringLit()).map(sl => Left(string(visitStringLit(sl)))) - val queryVariable = Option(ctx.queryParam.multipartIdentifier) - .map(mpi => Right(UnresolvedAttribute(visitMultipartIdentifier(mpi)))) + // With the new grammar, queryParam is now an expression + val queryParam = expression(ctx.queryParam) val targetVars = Option(ctx.targetVariable).toSeq .flatMap(v => visitMultipartIdentifierList(v)) val exprs = Option(ctx.executeImmediateUsing).map { visitExecuteImmediateUsing(_) }.getOrElse{ Seq.empty } - - ExecuteImmediateQuery(exprs, queryString.getOrElse(queryVariable.get), targetVars) + ExecuteImmediateQuery(queryParam, exprs, targetVars) Review Comment: Seem it's always replaced during analysis, we can probably call it `UnresolvedExecuteImmediate`, as it can be either query or command. -- 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