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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to