Skip to content

Commit 7fdb571

Browse files
LuciferYangsrowen
authored andcommitted
[SPARK-32890][SQL] Pass all sql/hive module UTs in Scala 2.13
### What changes were proposed in this pull request? This pr fix failed cases in sql hive module in Scala 2.13 as follow: - HiveSchemaInferenceSuite (1 FAILED -> PASS) - HiveSparkSubmitSuite (1 FAILED-> PASS) - StatisticsSuite (1 FAILED-> PASS) - HiveDDLSuite (1 FAILED-> PASS) After this patch all test passed in sql hive module in Scala 2.13. ### Why are the changes needed? We need to support a Scala 2.13 build. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? - Scala 2.12: Pass the Jenkins or GitHub Action - Scala 2.13: All tests passed. Do the following: ``` dev/change-scala-version.sh 2.13 mvn clean install -DskipTests -pl sql/hive -am -Pscala-2.13 -Phive mvn clean test -pl sql/hive -Pscala-2.13 -Phive ``` **Before** ``` Tests: succeeded 3662, failed 4, canceled 0, ignored 601, pending 0 *** 4 TESTS FAILED *** ``` **After** ``` Tests: succeeded 3666, failed 0, canceled 0, ignored 601, pending 0 All tests passed. ``` Closes #29760 from LuciferYang/sql-hive-test. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Sean Owen <srowen@gmail.com>
1 parent 657e39a commit 7fdb571

5 files changed

Lines changed: 4 additions & 4 deletions

File tree

Binary file not shown.

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSchemaInferenceSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class HiveSchemaInferenceSuite
129129
// properties out).
130130
assert(!externalCatalog.getTable(DATABASE, TEST_TABLE_NAME).schemaPreservesCase)
131131
val rawTable = client.getTable(DATABASE, TEST_TABLE_NAME)
132-
assert(rawTable.properties.filterKeys(_.startsWith(DATASOURCE_SCHEMA_PREFIX)) == Map.empty)
132+
assert(rawTable.properties.filterKeys(_.startsWith(DATASOURCE_SCHEMA_PREFIX)).isEmpty)
133133
schema
134134
}
135135

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSparkSubmitSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class HiveSparkSubmitSuite
153153
// For more detail, see sql/hive/src/test/resources/regression-test-SPARK-8489/*scala.
154154
// TODO: revisit for Scala 2.13 support
155155
val version = Properties.versionNumberString match {
156-
case v if v.startsWith("2.12") => v.substring(0, 4)
156+
case v if v.startsWith("2.12") || v.startsWith("2.13") => v.substring(0, 4)
157157
case x => throw new Exception(s"Unsupported Scala Version: $x")
158158
}
159159
val jarDir = getTestResourcePath("regression-test-SPARK-8489")

sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto
11281128
def checkColStatsProps(expected: Map[String, String]): Unit = {
11291129
sql(s"ANALYZE TABLE $tableName COMPUTE STATISTICS FOR COLUMNS " + stats.keys.mkString(", "))
11301130
val table = hiveClient.getTable("default", tableName)
1131-
val props = table.properties.filterKeys(_.startsWith("spark.sql.statistics.colStats"))
1131+
val props = table.properties.filterKeys(_.startsWith("spark.sql.statistics.colStats")).toMap
11321132
assert(props == expected)
11331133
}
11341134

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ class HiveDDLSuite
994994
|""".stripMargin)
995995
val newPart = catalog.getPartition(TableIdentifier("boxes"), Map("width" -> "4"))
996996
assert(newPart.storage.serde == Some(expectedSerde))
997-
assert(newPart.storage.properties.filterKeys(expectedSerdeProps.contains) ==
997+
assert(newPart.storage.properties.filterKeys(expectedSerdeProps.contains).toMap ==
998998
expectedSerdeProps)
999999
}
10001000

0 commit comments

Comments
 (0)