You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2018/01/04 04:27:05 UTC

[GitHub] spark pull request #20145: [SPARK-22950][SQL]Handle ChildFirstURLClassLoader...

Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20145#discussion_r159579366
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveUtilsSuite.scala ---
    @@ -42,4 +47,29 @@ class HiveUtilsSuite extends QueryTest with SQLTestUtils with TestHiveSingleton
           assert(hiveConf("foo") === "bar")
         }
       }
    +
    +  test("ChildFirstURLClassLoader's parent is null") {
    +    val conf = new SparkConf
    +    val contextClassLoader = Thread.currentThread().getContextClassLoader
    +    val loader = new FakeChildFirstURLClassLoader(Array(), contextClassLoader)
    +    Thread.currentThread().setContextClassLoader(loader)
    +    intercept[IllegalArgumentException](
    +      HiveUtils.newClientForMetadata(conf, SparkHadoopUtil.newConfiguration(conf)))
    +    Thread.currentThread().setContextClassLoader(contextClassLoader)
    --- End diff --
    
    we should use `try .. finally` to make sure we always set back the context class loader


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org