zsxwing commented on a change in pull request #29059: URL: https://github.com/apache/spark/pull/29059#discussion_r452595141
########## File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/client/HadoopVersionInfoSuite.scala ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.hive.client + +import java.io.File +import java.net.URLClassLoader + +import org.apache.hadoop.conf.Configuration + +import org.apache.spark.{SparkConf, SparkFunSuite} +import org.apache.spark.sql.hive.{HiveExternalCatalog, HiveUtils} + +/** + * This test suite requires a clean JVM because it's testing the initialization of static codes in + * `org.apache.hadoop.util.VersionInfo`. + */ +class HadoopVersionInfoSuite extends SparkFunSuite { + override protected val enableAutoThreadAudit = false + + test("SPARK-32256: Hadoop VersionInfo should be preloaded") { + val hadoopConf = new Configuration() + hadoopConf.set("test", "success") + hadoopConf.set("datanucleus.schema.autoCreateAll", "true") + hadoopConf.set("hive.metastore.schema.verification", "false") + + // Download jars for Hive 2.0 + val client = IsolatedClientLoader.forVersion( + hiveMetastoreVersion = "2.0", + hadoopVersion = "2.7.4", + sparkConf = new SparkConf(), + hadoopConf = hadoopConf, + config = HiveClientBuilder.buildConf(Map.empty), + ivyPath = HiveClientBuilder.ivyPath, Review comment: Just realized this will use the same ivy path as `HiveExternalCatalogVersionsSuite` on Jenkins. ``` 2020-07-09 17:21:08.423 - stdout> py4j.protocol.Py4JJavaError: An error occurred while calling o29.sql. 2020-07-09 17:21:08.423 - stdout> : java.lang.NullPointerException 2020-07-09 17:21:08.423 - stdout> at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792) 2020-07-09 17:21:08.423 - stdout> at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769) 2020-07-09 17:21:08.423 - stdout> at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744) 2020-07-09 17:21:08.423 - stdout> at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:462) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.client.IsolatedClientLoader$$anon$1.doLoadClass(IsolatedClientLoader.scala:216) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.client.IsolatedClientLoader$$anon$1.loadClass(IsolatedClientLoader.scala:210) 2020-07-09 17:21:08.423 - stdout> at java.lang.ClassLoader.loadClass(ClassLoader.java:411) 2020-07-09 17:21:08.423 - stdout> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:262) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:385) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:287) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog.client$lzycompute(HiveExternalCatalog.scala:66) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog.client(HiveExternalCatalog.scala:65) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply$mcZ$sp(HiveExternalCatalog.scala:195) 2020-07-09 17:21:08.423 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply(HiveExternalCatalog.scala:195) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply(HiveExternalCatalog.scala:195) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:97) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveExternalCatalog.databaseExists(HiveExternalCatalog.scala:194) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.SharedState.externalCatalog$lzycompute(SharedState.scala:114) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.SharedState.externalCatalog(SharedState.scala:102) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveSessionStateBuilder.externalCatalog(HiveSessionStateBuilder.scala:39) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveSessionStateBuilder.catalog$lzycompute(HiveSessionStateBuilder.scala:54) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveSessionStateBuilder.catalog(HiveSessionStateBuilder.scala:52) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveSessionStateBuilder$$anon$1.<init>(HiveSessionStateBuilder.scala:69) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.hive.HiveSessionStateBuilder.analyzer(HiveSessionStateBuilder.scala:69) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.BaseSessionStateBuilder$$anonfun$build$2.apply(BaseSessionStateBuilder.scala:293) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.BaseSessionStateBuilder$$anonfun$build$2.apply(BaseSessionStateBuilder.scala:293) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.SessionState.analyzer$lzycompute(SessionState.scala:79) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.internal.SessionState.analyzer(SessionState.scala:79) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.execution.QueryExecution.analyzed$lzycompute(QueryExecution.scala:57) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.execution.QueryExecution.analyzed(QueryExecution.scala:55) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:47) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:74) 2020-07-09 17:21:08.424 - stdout> at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:642) 2020-07-09 17:21:08.424 - stdout> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2020-07-09 17:21:08.424 - stdout> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2020-07-09 17:21:08.424 - stdout> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2020-07-09 17:21:08.424 - stdout> at java.lang.reflect.Method.invoke(Method.java:498) 2020-07-09 17:21:08.424 - stdout> at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) 2020-07-09 17:21:08.424 - stdout> at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) 2020-07-09 17:21:08.424 - stdout> at py4j.Gateway.invoke(Gateway.java:282) 2020-07-09 17:21:08.424 - stdout> at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) 2020-07-09 17:21:08.424 - stdout> at py4j.commands.CallCommand.execute(CallCommand.java:79) 2020-07-09 17:21:08.424 - stdout> at py4j.GatewayConnection.run(GatewayConnection.java:238) 2020-07-09 17:21:08.424 - stdout> at java.lang.Thread.run(Thread.java:748) ``` Let me use a temp directory instead and see how long it will take if we don't share the same ivy path. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
