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

gurwls223 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 72c708e6f10 [SPARK-40540][SQL][TESTS][FOLLOW-UP] Use a regex for List 
and ArrayBuffer for 'Struct Star Expansion' test
72c708e6f10 is described below

commit 72c708e6f10a7fda7740bc3a681d58435dd83384
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Thu Sep 29 23:05:06 2022 +0900

    [SPARK-40540][SQL][TESTS][FOLLOW-UP] Use a regex for List and ArrayBuffer 
for 'Struct Star Expansion' test
    
    ### What changes were proposed in this pull request?
    
    This PR is a minor followup of https://github.com/apache/spark/pull/37973 
to match the pattern of either `ArrayBuffer` (Scala 2.12) or `List` (Scala 
2.13) in "Struct Star Expansion" test case at `SQLQuerySuite.scala`.
    
    ### Why are the changes needed?
    
    Currently, the test fails with Scala 2.13 
(https://github.com/apache/spark/actions/runs/3146198025/jobs/5114388079):
    
    ```
    [info] - Struct Star Expansion *** FAILED *** (1 second, 801 milliseconds)
    [info]   Map("attributes" -> "List(a)") did not equal Map("attributes" -> 
"ArrayBuffer(a)") (SparkFunSuite.scala:328)
    [info]   Analysis:
    [info]   JavaCollectionWrappers$JMapWrapper(attributes: List(a) -> 
ArrayBuffer(a))
    [info]   org.scalatest.exceptions.TestFailedException:
    [info]   at 
org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
    [info]   at 
org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
    [info]   at 
org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
    [info]   at 
org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
    [info]   at 
org.apache.spark.SparkFunSuite.checkError(SparkFunSuite.scala:328)
    [info]   at 
org.apache.spark.SparkFunSuite.checkError(SparkFunSuite.scala:369)
    ```
    
    We should also consider Scala 2.13 case.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, test-only.
    
    ### How was this patch tested?
    
    Manually tested:
    
    ```scala
    scala> "List(a)".matches("(ArrayBuffer|List)\\(a\\)")
    res0: Boolean = true
    
    scala> "ArrayBuffer(a)".matches("(ArrayBuffer|List)\\(a\\)")
    res1: Boolean = true
    ```
    
    Closes #38045 from HyukjinKwon/SPARK-40540-followup.
    
    Authored-by: Hyukjin Kwon <gurwls...@apache.org>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
index 12f8274fb66..9fa9cd16371 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
@@ -1829,8 +1829,11 @@ class SQLQuerySuite extends QueryTest with 
SharedSparkSession with AdaptiveSpark
           sql("select a.* from testData2")
         },
         errorClass = "_LEGACY_ERROR_TEMP_1050",
-        parameters = Map("attributes" -> "ArrayBuffer(a)"),
-        context = ExpectedContext(fragment = "a.*", start = 7, stop = 9))
+        errorSubClass = None,
+        sqlState = None,
+        parameters = Map("attributes" -> "(ArrayBuffer|List)\\(a\\)"),
+        matchPVals = true,
+        queryContext = Array(ExpectedContext(fragment = "a.*", start = 7, stop 
= 9)))
     }
   }
 


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

Reply via email to