cloud-fan commented on code in PR #48950:
URL: https://github.com/apache/spark/pull/48950#discussion_r1856466335


##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionNode.scala:
##########
@@ -122,6 +130,20 @@ class SingleStatementExec(
    */
   var isExecuted = false
 
+  /**
+   * Plan with named parameters.
+   */
+  lazy val resolvedPlan: LogicalPlan = {
+    if (args.nonEmpty) {
+      NameParameterizedQuery(parsedPlan, args)
+    } else {
+      parsedPlan
+    }
+  }
+
+  /** Statement is result if it is a SELECT query, and it is not in control 
flow condition */
+  override def isResult: Boolean = parsedPlan.isInstanceOf[Project] && 
!isExecuted

Review Comment:
   With SQL pipe syntax, the root node may not always be `Project`. I think 
it's simpler to let the caller side check `df.logicalPlan`. If it's 
`CommandResult`, then it's not a query.



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