@@ -52,14 +52,18 @@ import org.apache.spark.util.Utils
52
52
@ ExtendedHiveTest
53
53
class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
54
54
import HiveExternalCatalogVersionsSuite ._
55
- private val isTestAtLeastJava9 = SystemUtils .isJavaVersionAtLeast(JavaVersion .JAVA_9 )
56
55
private val wareHousePath = Utils .createTempDir(namePrefix = " warehouse" )
57
56
private val tmpDataDir = Utils .createTempDir(namePrefix = " test-data" )
58
57
// For local test, you can set `spark.test.cache-dir` to a static value like `/tmp/test-spark`, to
59
58
// avoid downloading Spark of different versions in each run.
60
59
private val sparkTestingDir = Option (System .getProperty(SPARK_TEST_CACHE_DIR_SYSTEM_PROPERTY ))
61
60
.map(new File (_)).getOrElse(Utils .createTempDir(namePrefix = " test-spark" ))
62
61
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
+ }
63
67
64
68
override def afterAll (): Unit = {
65
69
try {
@@ -149,7 +153,9 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
149
153
new String (Files .readAllBytes(contentPath), StandardCharsets .UTF_8 )
150
154
}
151
155
152
- private def prepare (): Unit = {
156
+ override def beforeAll (): Unit = {
157
+ super .beforeAll()
158
+
153
159
val tempPyFile = File .createTempFile(" test" , " .py" )
154
160
// scalastyle:off line.size.limit
155
161
Files .write(tempPyFile.toPath,
@@ -199,7 +205,7 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
199
205
" --master" , " local[2]" ,
200
206
" --conf" , s " ${UI_ENABLED .key}=false " ,
201
207
" --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 " ,
203
209
" --conf" , s " ${HiveUtils .HIVE_METASTORE_JARS .key}=maven " ,
204
210
" --conf" , s " ${WAREHOUSE_PATH .key}= ${wareHousePath.getCanonicalPath}" ,
205
211
" --conf" , s " spark.sql.test.version.index= $index" ,
@@ -211,23 +217,14 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
211
217
tempPyFile.delete()
212
218
}
213
219
214
- override def beforeAll (): Unit = {
215
- super .beforeAll()
216
- if (! isTestAtLeastJava9) {
217
- prepare()
218
- }
219
- }
220
-
221
220
test(" backward compatibility" ) {
222
- // TODO SPARK-28704 Test backward compatibility on JDK9+ once we have a version supports JDK9+
223
- assume(! isTestAtLeastJava9)
224
221
val args = Seq (
225
222
" --class" , PROCESS_TABLES .getClass.getName.stripSuffix(" $" ),
226
223
" --name" , " HiveExternalCatalog backward compatibility test" ,
227
224
" --master" , " local[2]" ,
228
225
" --conf" , s " ${UI_ENABLED .key}=false " ,
229
226
" --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 " ,
231
228
" --conf" , s " ${HiveUtils .HIVE_METASTORE_JARS .key}=maven " ,
232
229
" --conf" , s " ${WAREHOUSE_PATH .key}= ${wareHousePath.getCanonicalPath}" ,
233
230
" --driver-java-options" , s " -Dderby.system.home= ${wareHousePath.getCanonicalPath}" ,
@@ -252,7 +249,9 @@ object PROCESS_TABLES extends QueryTest with SQLTestUtils {
252
249
// do not throw exception during object initialization.
253
250
case NonFatal (_) => Seq (" 3.0.1" , " 2.4.7" ) // A temporary fallback to use a specific version
254
251
}
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 ))
256
255
}
257
256
258
257
protected var spark : SparkSession = _
0 commit comments