miland-db commented on code in PR #47609:
URL: https://github.com/apache/spark/pull/47609#discussion_r1722003247


##########
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -651,13 +652,31 @@ class SparkSession private(
     withActive {
       val plan = tracker.measurePhase(QueryPlanningTracker.PARSING) {
         val parsedPlan = sessionState.sqlParser.parsePlan(sqlText)
-        if (args.nonEmpty) {
-          PosParameterizedQuery(parsedPlan, 
args.map(lit(_).expr).toImmutableArraySeq)
-        } else {
-          parsedPlan
+        parsedPlan match {
+          case compoundBody: CompoundBody => compoundBody
+          case logicalPlan: LogicalPlan if args.nonEmpty =>
+            PosParameterizedQuery(logicalPlan, 
args.map(lit(_).expr).toImmutableArraySeq)
+          case p =>
+            assert(args.isEmpty, "Named parameters are not supported for batch 
queries")

Review Comment:
   Ok, here we should not even assert because `p` can be `LogicalPlan` with no 
arguments. The question is what if we have `CompoundBody` with arguments, then 
we should maybe throw an error. Do you agree?
   
   Currently we ignore if arguments if we encounter a script.



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