Skip to content

Commit d7f4b2a

Browse files
AngersZhuuuudongjoon-hyun
authored andcommitted
[SPARK-28704][SQL][TEST] Add back Skiped HiveExternalCatalogVersionsSuite in HiveSparkSubmitSuite at JDK9+
### What changes were proposed in this pull request? We skip test HiveExternalCatalogVersionsSuite when testing with JAVA_9 or later because our previous version does not support JAVA_9 or later. We now add it back since we have a version supports JAVA_9 or later. ### Why are the changes needed? To recover test coverage. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Check CI logs. Closes #30451 from AngersZhuuuu/SPARK-28704. Authored-by: angerszhu <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 517b810 commit d7f4b2a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@ import org.apache.spark.util.Utils
5252
@ExtendedHiveTest
5353
class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
5454
import HiveExternalCatalogVersionsSuite._
55-
private val isTestAtLeastJava9 = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9)
5655
private val wareHousePath = Utils.createTempDir(namePrefix = "warehouse")
5756
private val tmpDataDir = Utils.createTempDir(namePrefix = "test-data")
5857
// For local test, you can set `spark.test.cache-dir` to a static value like `/tmp/test-spark`, to
5958
// avoid downloading Spark of different versions in each run.
6059
private val sparkTestingDir = Option(System.getProperty(SPARK_TEST_CACHE_DIR_SYSTEM_PROPERTY))
6160
.map(new File(_)).getOrElse(Utils.createTempDir(namePrefix = "test-spark"))
6261
private val unusedJar = TestUtils.createJarWithClasses(Seq.empty)
62+
val hiveVersion = if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9)) {
63+
"2.3.7"
64+
} else {
65+
"1.2.1"
66+
}
6367

6468
override def afterAll(): Unit = {
6569
try {
@@ -149,7 +153,9 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
149153
new String(Files.readAllBytes(contentPath), StandardCharsets.UTF_8)
150154
}
151155

152-
private def prepare(): Unit = {
156+
override def beforeAll(): Unit = {
157+
super.beforeAll()
158+
153159
val tempPyFile = File.createTempFile("test", ".py")
154160
// scalastyle:off line.size.limit
155161
Files.write(tempPyFile.toPath,
@@ -199,7 +205,7 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
199205
"--master", "local[2]",
200206
"--conf", s"${UI_ENABLED.key}=false",
201207
"--conf", s"${MASTER_REST_SERVER_ENABLED.key}=false",
202-
"--conf", s"${HiveUtils.HIVE_METASTORE_VERSION.key}=1.2.1",
208+
"--conf", s"${HiveUtils.HIVE_METASTORE_VERSION.key}=$hiveVersion",
203209
"--conf", s"${HiveUtils.HIVE_METASTORE_JARS.key}=maven",
204210
"--conf", s"${WAREHOUSE_PATH.key}=${wareHousePath.getCanonicalPath}",
205211
"--conf", s"spark.sql.test.version.index=$index",
@@ -211,23 +217,14 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
211217
tempPyFile.delete()
212218
}
213219

214-
override def beforeAll(): Unit = {
215-
super.beforeAll()
216-
if (!isTestAtLeastJava9) {
217-
prepare()
218-
}
219-
}
220-
221220
test("backward compatibility") {
222-
// TODO SPARK-28704 Test backward compatibility on JDK9+ once we have a version supports JDK9+
223-
assume(!isTestAtLeastJava9)
224221
val args = Seq(
225222
"--class", PROCESS_TABLES.getClass.getName.stripSuffix("$"),
226223
"--name", "HiveExternalCatalog backward compatibility test",
227224
"--master", "local[2]",
228225
"--conf", s"${UI_ENABLED.key}=false",
229226
"--conf", s"${MASTER_REST_SERVER_ENABLED.key}=false",
230-
"--conf", s"${HiveUtils.HIVE_METASTORE_VERSION.key}=1.2.1",
227+
"--conf", s"${HiveUtils.HIVE_METASTORE_VERSION.key}=$hiveVersion",
231228
"--conf", s"${HiveUtils.HIVE_METASTORE_JARS.key}=maven",
232229
"--conf", s"${WAREHOUSE_PATH.key}=${wareHousePath.getCanonicalPath}",
233230
"--driver-java-options", s"-Dderby.system.home=${wareHousePath.getCanonicalPath}",
@@ -252,7 +249,9 @@ object PROCESS_TABLES extends QueryTest with SQLTestUtils {
252249
// do not throw exception during object initialization.
253250
case NonFatal(_) => Seq("3.0.1", "2.4.7") // A temporary fallback to use a specific version
254251
}
255-
versions.filter(v => v.startsWith("3") || !TestUtils.isPythonVersionAtLeast38())
252+
versions
253+
.filter(v => v.startsWith("3") || !TestUtils.isPythonVersionAtLeast38())
254+
.filter(v => v.startsWith("3") || !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9))
256255
}
257256

258257
protected var spark: SparkSession = _

0 commit comments

Comments
 (0)