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

dongjoon 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 bcb0817904ac [SPARK-52798][SQL][TESTS][FOLLOWUP] Fix a unit test 
failure due to the ANSI assumption
bcb0817904ac is described below

commit bcb0817904ac89021b8ced93f3dcf4dbd25df2fb
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Fri Oct 24 15:14:42 2025 -0700

    [SPARK-52798][SQL][TESTS][FOLLOWUP] Fix a unit test failure due to the ANSI 
assumption
    
    ### What changes were proposed in this pull request?
    
    This PR aims to fix a unit test failure due to the ANSI assumption.
    
    ### Why are the changes needed?
    
    The non-ANSI CI has been broken for a week.
    - https://github.com/apache/spark/actions/workflows/build_non_ansi.yml
      - https://github.com/apache/spark/actions/runs/18623628999/job/53098232441
    
    ```
    $ SPARK_ANSI_SQL_MODE=false build/sbt "sql/testOnly *.ApproxTopKSuite -- -z 
SPARK-52798"
    ...
    [info] - SPARK-52798: string vs boolean - fail at combine *** FAILED *** 
(10 milliseconds)
    [info]   org.apache.spark.sql.catalyst.ExtendedAnalysisException: 
[INCOMPATIBLE_COLUMN_TYPE] UNION can only be performed on tables with 
compatible column types. The first column of the second table is 
"STRUCT<sketch: BINARY NOT NULL, maxItemsTracked: INT NOT NULL, itemDataType: 
BOOLEAN, itemDataTypeDDL: STRING NOT NULL>" type which is not compatible with 
"STRUCT<sketch: BINARY NOT NULL, maxItemsTracked: INT NOT NULL, itemDataType: 
STRING, itemDataTypeDDL: STRING NOT NULL>" at the same [...]
    ...
    [info] *** 1 TEST FAILED ***
    [error] Failed tests:
    [error]         org.apache.spark.sql.ApproxTopKSuite
    [error] (sql / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
    [error] Total time: 34 s, completed Oct 24, 2025, 2:54:17 PM
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Manual tests.
    
    ```
    $ SPARK_ANSI_SQL_MODE=false build/sbt "sql/testOnly *.ApproxTopKSuite -- -z 
SPARK-52798"
    ...
    [info] Tests: succeeded 76, failed 0, canceled 0, ignored 0, pending 0
    [info] All tests passed.
    [success] Total time: 41 s, completed Oct 24, 2025, 3:08:26 PM
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #52726 from dongjoon-hyun/SPARK-52798.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../org/apache/spark/sql/ApproxTopKSuite.scala     | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/sql/core/src/test/scala/org/apache/spark/sql/ApproxTopKSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/ApproxTopKSuite.scala
index 982c9ff90da7..7eb14df9b851 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/ApproxTopKSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/ApproxTopKSuite.scala
@@ -736,17 +736,19 @@ class ApproxTopKSuite extends QueryTest with 
SharedSparkSession {
   }
 
   test("SPARK-52798: string vs boolean - fail at combine") {
-    val seq1 = Seq("'a'", "'b'", "'c'", "'c'", "'c'", "'c'", "'d'", "'d'")
-    val seq2 = Seq("(true)", "(true)", "(false)", "(false)")
-    withView("accumulation1", "accumulation2", "unioned") {
-      setupMixedTypeAccumulation(seq1, seq2)
-      checkError(
-        exception = intercept[SparkRuntimeException] {
-          sql("SELECT approx_top_k_combine(acc, 30) as com FROM 
unioned;").collect()
-        },
-        condition = "APPROX_TOP_K_SKETCH_TYPE_NOT_MATCH",
-        parameters = Map("type1" -> toSQLType(StringType), "type2" -> 
toSQLType(BooleanType))
-      )
+    withSQLConf("spark.sql.ansi.enabled" -> "true") {
+      val seq1 = Seq("'a'", "'b'", "'c'", "'c'", "'c'", "'c'", "'d'", "'d'")
+      val seq2 = Seq("(true)", "(true)", "(false)", "(false)")
+      withView("accumulation1", "accumulation2", "unioned") {
+        setupMixedTypeAccumulation(seq1, seq2)
+        checkError(
+          exception = intercept[SparkRuntimeException] {
+            sql("SELECT approx_top_k_combine(acc, 30) as com FROM 
unioned;").collect()
+          },
+          condition = "APPROX_TOP_K_SKETCH_TYPE_NOT_MATCH",
+          parameters = Map("type1" -> toSQLType(StringType), "type2" -> 
toSQLType(BooleanType))
+        )
+      }
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to