panbingkun commented on code in PR #47754:
URL: https://github.com/apache/spark/pull/47754#discussion_r1723148415


##########
sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingInterpreterSuite.scala:
##########
@@ -389,25 +389,44 @@ class SqlScriptingInterpreterSuite extends QueryTest with 
SharedSparkSession {
   }
 
   test("if's condition must return a single row data") {
-    withTable("t") {
-      val commands =
+    withTable("t1", "t2") {
+      // empty row
+      val commands1 =
+        """
+          |BEGIN
+          |  CREATE TABLE t1 (a BOOLEAN) USING parquet;
+          |  IF (SELECT * FROM t1) THEN

Review Comment:
   Its `SparkPlan` is like follows:
   <img width="915" alt="image" 
src="https://github.com/user-attachments/assets/c41edbc2-f80e-4ac4-b00b-efb4907ace3a";>
   
   - `ScalarSubquery` return `null`
   
https://github.com/apache/spark/blob/bf3ad7e94afb5416d995dc22344566899ee7c4b0/sql/core/src/main/scala/org/apache/spark/sql/execution/subquery.scala#L93
   
   - `ProjectExec` return `Row(null)`
   
https://github.com/apache/spark/blob/899fad4710bef174684deee64314ac483c16c494/sql/core/src/main/scala/org/apache/spark/sql/execution/basicPhysicalOperators.scala#L70-L77
   <img width="1054" alt="image" 
src="https://github.com/user-attachments/assets/dada8d92-9188-4dfd-9456-5fbc6bffa107";>



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