You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2024/05/02 14:18:21 UTC
(spark) branch master updated: [SPARK-48072][SQL][TESTS] Improve SQLQuerySuite test output - use `===` instead of `sameElements` for Arrays
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 5bbbc6c25bb7 [SPARK-48072][SQL][TESTS] Improve SQLQuerySuite test output - use `===` instead of `sameElements` for Arrays
5bbbc6c25bb7 is described below
commit 5bbbc6c25bb7cb7cf24330a384c67bc3e8b3a5e4
Author: Vladimir Golubev <vl...@databricks.com>
AuthorDate: Thu May 2 07:18:11 2024 -0700
[SPARK-48072][SQL][TESTS] Improve SQLQuerySuite test output - use `===` instead of `sameElements` for Arrays
### What changes were proposed in this pull request?
Improve test output for the actual query to be printed alongside of expected
### Why are the changes needed?
To reduce confusion later
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
`testOnly org.apache.spark.sql.SQLQuerySuite -- -z SPARK-47939`
`testOnly org.apache.spark.sql.SQLQuerySuite -- -z SPARK-37965`
`testOnly org.apache.spark.sql.SQLQuerySuite -- -z SPARK-27442`
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #46318 from vladimirg-db/vladimirg-db/improve-test-output-for-sql-query-suite.
Authored-by: Vladimir Golubev <vl...@databricks.com>
Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
.../src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala | 10 +++++-----
1 file changed, 5 insertions(+), 5 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 470f8ff4cd85..56c364e20846 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
@@ -4399,8 +4399,8 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
checkAnswer(df,
Row(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ::
Row(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) :: Nil)
- assert(df.schema.names.sameElements(
- Array("max(t)", "max(t", "=", "\n", ";", "a b", "{", ".", "a.b", "a")))
+ assert(df.schema.names ===
+ Array("max(t)", "max(t", "=", "\n", ";", "a b", "{", ".", "a.b", "a"))
checkAnswer(df.select("`max(t)`", "`a b`", "`{`", "`.`", "`a.b`"),
Row(1, 6, 7, 8, 9) :: Row(2, 12, 14, 16, 18) :: Nil)
checkAnswer(df.where("`a.b` > 10"),
@@ -4418,8 +4418,8 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
checkAnswer(df,
Row(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) ::
Row(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22) :: Nil)
- assert(df.schema.names.sameElements(
- Array("max(t)", "max(t", "=", "\n", ";", "a b", "{", ".", "a.b", "a", ",")))
+ assert(df.schema.names ===
+ Array("max(t)", "max(t", "=", "\n", ";", "a b", "{", ".", "a.b", "a", ","))
checkAnswer(df.select("`max(t)`", "`a b`", "`{`", "`.`", "`a.b`"),
Row(1, 6, 7, 8, 9) :: Row(2, 12, 14, 16, 18) :: Nil)
checkAnswer(df.where("`a.b` > 10"),
@@ -4754,7 +4754,7 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
df.collect()
.map(_.getString(0))
.map(_.replaceAll("#[0-9]+", "#N"))
- .sameElements(Array(plan.stripMargin))
+ === Array(plan.stripMargin)
)
checkQueryPlan(
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org