You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/03/12 02:26:11 UTC

[GitHub] [iceberg] dixingxing0 commented on a change in pull request #2075: Avoid reset hive configuration to default value.

dixingxing0 commented on a change in pull request #2075:
URL: https://github.com/apache/iceberg/pull/2075#discussion_r592866290



##########
File path: hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveClientPool.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.iceberg.hive;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestHiveClientPool {
+
+  private static final String HIVE_SITE_CONTENT = "<?xml version=\"1.0\"?>\n" +
+          "<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>\n" +
+          "<configuration>\n" +
+          "  <property>\n" +
+          "    <name>hive.metastore.sasl.enabled</name>\n" +
+          "    <value>true</value>\n" +
+          "  </property>\n" +
+          "</configuration>\n";
+
+  @Test
+  public void testConf() {
+    HiveConf conf = createHiveConf();
+    conf.set(HiveConf.ConfVars.METASTOREURIS.varname, "thrift://locahost:12345");
+    conf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, "file:/mywarehouse/");
+    conf.setInt("iceberg.hive.client-pool-size", 10);
+
+    HiveClientPool clientPool = new HiveClientPool(conf);
+    HiveConf clientConf = clientPool.hiveConf();
+
+    // hive will pick up system property whenever a new HiveConf is created
+    // see org.apache.iceberg.hive.TestHiveMetastore.start(int)
+    if (System.getProperty(HiveConf.ConfVars.METASTOREURIS.varname) != null) {
+      Assert.assertEquals(System.getProperty(HiveConf.ConfVars.METASTOREURIS.varname),
+              clientConf.get(HiveConf.ConfVars.METASTOREURIS.varname));
+    } else {
+      Assert.assertEquals(conf.get(HiveConf.ConfVars.METASTOREURIS.varname),
+              clientConf.get(HiveConf.ConfVars.METASTOREURIS.varname));
+    }

Review comment:
       Thanks peter, this test branch lead misunderstanding, it's totaly has nothing to do with this PR, i will delete it. 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org