kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [04/37] kylin git commit: KYLIN-2577, fix hiveCmdBuilderTest UT
Date Fri, 19 May 2017 10:04:31 GMT
KYLIN-2577, fix hiveCmdBuilderTest UT


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/299b5841
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/299b5841
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/299b5841

Branch: refs/heads/master
Commit: 299b584151f75f475c61a88bd15167dbbd744386
Parents: ea5fcff
Author: Cheng Wang <cheng.wang@kyligence.io>
Authored: Sat Apr 29 20:34:08 2017 +0800
Committer: Cheng Wang <cheng.wang@kyligence.io>
Committed: Sat Apr 29 20:34:08 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/util/HiveCmdBuilder.java     |  6 ++----
 .../org/apache/kylin/common/util/HiveCmdBuilderTest.java | 11 +++++++++--
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/299b5841/core-common/src/main/java/org/apache/kylin/common/util/HiveCmdBuilder.java
----------------------------------------------------------------------
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 9279973..255867a 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
@@ -61,9 +61,8 @@ public class HiveCmdBuilder {
             for (String statement : statements) {
                 buf.append(statement).append("\n");
             }
-            buf.append("\"").append(" \\").append("\n");
+            buf.append("\"");
             buf.append(parseProps());
-            buf.append("\n");
             break;
         case BEELINE:
             BufferedWriter bw = null;
@@ -110,11 +109,10 @@ public class HiveCmdBuilder {
     private String parseProps() {
         StringBuilder s = new StringBuilder();
         for (Map.Entry<String, String> prop : hiveConfProps.entrySet()) {
-            s.append("--hiveconf ");
+            s.append(" --hiveconf ");
             s.append(prop.getKey());
             s.append("=");
             s.append(prop.getValue());
-            s.append(" \\").append("\n");
         }
         return s.toString();
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/299b5841/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java
b/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java
index 3bc34b4..d847575 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/HiveCmdBuilderTest.java
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
@@ -48,12 +50,17 @@ public class HiveCmdBuilderTest {
     public void testHiveCLI() {
         System.setProperty("kylin.source.hive.client", "cli");
 
+        Map<String, String> hiveProps = new HashMap<>();
+        hiveProps.put("hive.execution.engine", "mr");
+        Map<String, String> hivePropsOverwrite = new HashMap<>();
+        hivePropsOverwrite.put("hive.execution.engine", "tez");
         HiveCmdBuilder hiveCmdBuilder = new HiveCmdBuilder();
         hiveCmdBuilder.addStatement("USE default;");
         hiveCmdBuilder.addStatement("DROP TABLE test;");
         hiveCmdBuilder.addStatement("SHOW\n TABLES;");
-
-        assertEquals("hive -e \"USE default;\nDROP TABLE test;\nSHOW\n TABLES;\n\"", hiveCmdBuilder.build());
+        hiveCmdBuilder.setHiveConfProps(hiveProps);
+        hiveCmdBuilder.overwriteHiveProps(hivePropsOverwrite);
+        assertEquals("hive -e \"USE default;\nDROP TABLE test;\nSHOW\n TABLES;\n\" --hiveconf
hive.execution.engine=tez", hiveCmdBuilder.build());
     }
 
     @Test


Mime
View raw message