kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject [kylin] 06/10: KYLIN-3277 Code review
Date Wed, 04 Apr 2018 04:12:17 GMT
This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 417c4b646eb28c3f5dd51378e5cac1546e65c7ff
Author: nichunen <chunen.ni@kyligence.io>
AuthorDate: Tue Mar 27 22:40:19 2018 +0800

    KYLIN-3277 Code review
---
 .../apache/kylin/common/util/HiveCmdBuilder.java   |  7 ----
 .../kylin/common/util/HiveConfigurationUtil.java   | 19 +++++-----
 .../common/util/HiveConfigurationUtilTest.java     | 40 ++++++++++++++++++++++
 .../kylin/source/hive/BeelineHiveClient.java       |  3 +-
 4 files changed, 50 insertions(+), 19 deletions(-)

diff --git a/core-common/src/main/java/org/apache/kylin/common/util/HiveCmdBuilder.java b/core-common/src/main/java/org/apache/kylin/common/util/HiveCmdBuilder.java
index 9a9c65b..1823dfc 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/HiveCmdBuilder.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/HiveCmdBuilder.java
@@ -18,20 +18,13 @@
 
 package org.apache.kylin.common.util;
 
-import java.io.File;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Map;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.kylin.common.KylinConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
 
 import com.google.common.collect.Lists;
 
diff --git a/core-common/src/main/java/org/apache/kylin/common/util/HiveConfigurationUtil.java
b/core-common/src/main/java/org/apache/kylin/common/util/HiveConfigurationUtil.java
index a8cba61..1c6f985 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/HiveConfigurationUtil.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/HiveConfigurationUtil.java
@@ -18,20 +18,21 @@
 
 package org.apache.kylin.common.util;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.kylin.common.KylinConfig;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
+import static org.apache.kylin.common.util.HiveCmdBuilder.HIVE_CONF_FILENAME;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-import static org.apache.kylin.common.util.HiveCmdBuilder.HIVE_CONF_FILENAME;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.kylin.common.KylinConfig;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
 
 /**
  * @author ycq
@@ -97,5 +98,3 @@ public class HiveConfigurationUtil {
     }
 
 }
-
-
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/HiveConfigurationUtilTest.java
b/core-common/src/test/java/org/apache/kylin/common/util/HiveConfigurationUtilTest.java
new file mode 100644
index 0000000..d4019a9
--- /dev/null
+++ b/core-common/src/test/java/org/apache/kylin/common/util/HiveConfigurationUtilTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.kylin.common.util;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class HiveConfigurationUtilTest {
+    @Before
+    public void setup() {
+        System.setProperty("log4j.configuration", "file:../build/conf/kylin-tools-log4j.properties");
+        System.setProperty("KYLIN_CONF", LocalFileMetadataTestCase.LOCALMETA_TEST_DATA);
+    }
+
+    @Test
+    public void testHiveConf() {
+        Properties properties = HiveConfigurationUtil.loadHiveJDBCProperties();
+        assertTrue(properties.containsKey("hiveconf:hive.auto.convert.join.noconditionaltask.size"));
+    }
+}
diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/BeelineHiveClient.java
b/source-hive/src/main/java/org/apache/kylin/source/hive/BeelineHiveClient.java
index 593ad96..52b752c 100644
--- a/source-hive/src/main/java/org/apache/kylin/source/hive/BeelineHiveClient.java
+++ b/source-hive/src/main/java/org/apache/kylin/source/hive/BeelineHiveClient.java
@@ -30,10 +30,10 @@ import java.util.Properties;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.kylin.common.util.DBUtils;
+import org.apache.kylin.common.util.HiveConfigurationUtil;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
-import org.apache.kylin.common.util.HiveConfigurationUtil;
 
 public class BeelineHiveClient implements IHiveClient {
 
@@ -43,7 +43,6 @@ public class BeelineHiveClient implements IHiveClient {
     private Statement stmt;
     private DatabaseMetaData metaData;
 
-
     public BeelineHiveClient(String beelineParams) {
         if (StringUtils.isEmpty(beelineParams)) {
             throw new IllegalArgumentException("BeelineParames cannot be empty");

-- 
To stop receiving notification emails like this one, please contact
shaofengshi@apache.org.

Mime
View raw message