This is an automated email from the ASF dual-hosted git repository.

yangjie01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new c7c1021693a0 [SPARK-52300][SQL][TEST] Fix invalid 
AnalysisConfOverrideSuite
c7c1021693a0 is described below

commit c7c1021693a01a476b234773dec2d30ca134d250
Author: Cheng Pan <cheng...@apache.org>
AuthorDate: Wed Jul 23 11:07:46 2025 +0800

    [SPARK-52300][SQL][TEST] Fix invalid AnalysisConfOverrideSuite
    
    ### What changes were proposed in this pull request?
    
    Test `AnalysisConfOverrideSuite` is invalid, see inline comments for 
details.
    
    ### Why are the changes needed?
    
    Fix invalid tests.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    ```
    $ build/sbt "sql/testOnly *AnalysisConfOverrideSuite"
    ...
    [info] AnalysisConfOverrideSuite:
    [info] - simple plan (34 milliseconds)
    [info] - CTE (43 milliseconds)
    [info] - Subquery (46 milliseconds)
    [info] - View (2 seconds, 395 milliseconds)
    [info] - user defined SQL functions (596 milliseconds)
    [info] - user defined SQL functions - test conf disabled (449 milliseconds)
    [info] Run completed in 6 seconds, 817 milliseconds.
    [info] Total number of tests run: 6
    [info] Suites: completed 1, aborted 0
    [info] Tests: succeeded 6, failed 0, canceled 0, ignored 0, pending 0
    [info] All tests passed.
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #51612 from pan3793/SPARK-52300-followup.
    
    Authored-by: Cheng Pan <cheng...@apache.org>
    Signed-off-by: yangjie01 <yangji...@baidu.com>
---
 .../sql/analysis/AnalysisConfOverrideSuite.scala   | 46 ++++++++++------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/analysis/AnalysisConfOverrideSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/analysis/AnalysisConfOverrideSuite.scala
index 6f2b348e011d..a473bb6a02d7 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/analysis/AnalysisConfOverrideSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/analysis/AnalysisConfOverrideSuite.scala
@@ -18,6 +18,7 @@
 package org.apache.spark.sql.analysis
 
 import org.apache.spark.SparkConf
+import org.apache.spark.SparkNoSuchElementException
 import org.apache.spark.sql.SparkSessionExtensions
 import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
 import org.apache.spark.sql.catalyst.rules.Rule
@@ -27,7 +28,7 @@ class AnalysisConfOverrideSuite extends SharedSparkSession {
 
   override protected def sparkConf: SparkConf = {
     super.sparkConf
-      .set("spark.sql.extensions", 
"com.databricks.sql.ConfOverrideValidationExtensions")
+      .set("spark.sql.extensions", 
classOf[ConfOverrideValidationExtensions].getName)
   }
 
   override def beforeAll(): Unit = {
@@ -47,7 +48,7 @@ class AnalysisConfOverrideSuite extends SharedSparkSession {
       val key = "spark.sql.catalog.x.y"
       val value = "true"
       withSQLConf(key -> value) {
-        f
+        f(key, value)
       }
     }
   }
@@ -107,18 +108,15 @@ class AnalysisConfOverrideSuite extends 
SharedSparkSession {
             |""".stripMargin
         )
         spark.sql(
-          """CREATE OR REPLACE FUNCTION f3(in bigint) RETURNS (out bigint)
+          """CREATE OR REPLACE FUNCTION f3(in bigint) RETURNS bigint
             |RETURN in + 1
             |""".stripMargin
         )
-        ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-          spark.sql("SELECT * FROM f1()")
-        }
-        ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-          spark.sql("SELECT * FROM f2()")
-        }
-        ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-          spark.sql("SELECT f3(1)")
+
+        ("SELECT * FROM f1()" :: "SELECT * FROM f2()" :: "SELECT f3(1)" :: 
Nil).foreach { query =>
+          ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
+            spark.sql(query)
+          }
         }
       }
     }
@@ -142,24 +140,20 @@ class AnalysisConfOverrideSuite extends 
SharedSparkSession {
               |""".stripMargin
           )
           spark.sql(
-            """CREATE OR REPLACE FUNCTION f3(in bigint) RETURNS (out bigint)
+            """CREATE OR REPLACE FUNCTION f3(in bigint) RETURNS bigint
               |RETURN in + 1
               |""".stripMargin
           )
-          intercept[AssertionError] {
-            ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-              spark.sql("SELECT * FROM f1()")
-            }
-          }
-          intercept[AssertionError] {
-            ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-              spark.sql("SELECT * FROM f2()")
-            }
-          }
-          intercept[AssertionError] {
-            ValidateConfOverrideRule.withConfValidationEnabled(key, value) {
-              spark.sql("SELECT f3(1)")
-            }
+
+          ("SELECT * FROM f1()" :: "SELECT * FROM f2()" :: "SELECT f3(1)" :: 
Nil).foreach { query =>
+            checkError(
+              exception = intercept[SparkNoSuchElementException] {
+                ValidateConfOverrideRule.withConfValidationEnabled(key, value) 
{
+                  spark.sql(query)
+                }
+              },
+              condition = "SQL_CONF_NOT_FOUND",
+              parameters = Map("sqlConf" -> "\"spark.sql.catalog.x.y\""))
           }
         }
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to