KYLIN-1054 Fix some test issues
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/e72a6b6b Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/e72a6b6b Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/e72a6b6b Branch: refs/heads/1.x-staging Commit: e72a6b6b311510eb6d42625b7c9abdbe506e1227 Parents: 1dad1ed Author: lidongsjtu <lid...@apache.org> Authored: Thu Feb 25 13:52:12 2016 +0800 Committer: lidongsjtu <lid...@apache.org> Committed: Thu Feb 25 16:43:36 2016 +0800 ---------------------------------------------------------------------- conf/kylin.properties | 4 ---- examples/test_case_data/sandbox/kylin.properties | 3 +-- .../java/org/apache/kylin/job/common/HiveCmdBuilder.java | 11 ++++++++++- .../java/org/apache/kylin/job/HiveCmdBuilderTest.java | 2 ++ 4 files changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/e72a6b6b/conf/kylin.properties ---------------------------------------------------------------------- diff --git a/conf/kylin.properties b/conf/kylin.properties index 07af97b..e0727ed 100644 --- a/conf/kylin.properties +++ b/conf/kylin.properties @@ -70,10 +70,6 @@ kylin.job.status.with.kerberos=false # Hive database name for putting the intermediate flat tables kylin.job.hive.database.for.intermediatetable=default -# Hive client modes: cli or beeline, cli by default -kylin.hive.client= -kylin.hive.beeline.params= - #default compression codec for htable,snappy,lzo,gzip,lz4 kylin.hbase.default.compression.codec=snappy http://git-wip-us.apache.org/repos/asf/kylin/blob/e72a6b6b/examples/test_case_data/sandbox/kylin.properties ---------------------------------------------------------------------- diff --git a/examples/test_case_data/sandbox/kylin.properties b/examples/test_case_data/sandbox/kylin.properties index 1901a64..be1e272 100644 --- a/examples/test_case_data/sandbox/kylin.properties +++ b/examples/test_case_data/sandbox/kylin.properties @@ -60,8 +60,7 @@ kylin.job.yarn.app.rest.check.interval.seconds=10 kylin.job.hive.database.for.intermediatetable=default # Hive client modes: cli or beeline, cli by default -kylin.hive.client= -kylin.hive.beeline.params=-u 'jdbc:hive2://localhost:10000' +kylin.hive.beeline.params=--hiveconf hive.security.authorization.sqlstd.confwhitelist.append='mapreduce.job.*|dfs.*' -u 'jdbc:hive2://localhost:10000' #default compression codec for htable,snappy,lzo,gzip,lz4 kylin.hbase.default.compression.codec=gzip http://git-wip-us.apache.org/repos/asf/kylin/blob/e72a6b6b/job/src/main/java/org/apache/kylin/job/common/HiveCmdBuilder.java ---------------------------------------------------------------------- diff --git a/job/src/main/java/org/apache/kylin/job/common/HiveCmdBuilder.java b/job/src/main/java/org/apache/kylin/job/common/HiveCmdBuilder.java index abfd5e3..db345c8 100644 --- a/job/src/main/java/org/apache/kylin/job/common/HiveCmdBuilder.java +++ b/job/src/main/java/org/apache/kylin/job/common/HiveCmdBuilder.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import org.apache.commons.io.IOUtils; import org.apache.kylin.common.KylinConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; @@ -33,6 +35,8 @@ import com.google.common.collect.Lists; * Created by dongli on 2/21/16. */ public class HiveCmdBuilder { + private static final Logger logger = LoggerFactory.getLogger(HiveCmdBuilder.class); + public enum HiveClientMode { CLI, BEELINE } @@ -60,11 +64,14 @@ public class HiveCmdBuilder { case BEELINE: BufferedWriter bw = null; try { - File tmpHql = File.createTempFile("beeline", ".hql"); + File tmpHql = File.createTempFile("beeline_", ".hql"); + StringBuffer hqlBuf = new StringBuffer(); bw = new BufferedWriter(new FileWriter(tmpHql)); for (String statement : statements) { bw.write(statement); bw.newLine(); + + hqlBuf.append(statement).append("\n"); } buf.append("beeline "); buf.append(kylinConfig.getHiveBeelineParams()); @@ -72,6 +79,8 @@ public class HiveCmdBuilder { buf.append(tmpHql.getAbsolutePath()); buf.append(";rm -f "); buf.append(tmpHql.getAbsolutePath()); + + logger.info("The statements to execute in beeline: \n" + hqlBuf); } catch (IOException e) { throw new RuntimeException(e); } finally { http://git-wip-us.apache.org/repos/asf/kylin/blob/e72a6b6b/job/src/test/java/org/apache/kylin/job/HiveCmdBuilderTest.java ---------------------------------------------------------------------- diff --git a/job/src/test/java/org/apache/kylin/job/HiveCmdBuilderTest.java b/job/src/test/java/org/apache/kylin/job/HiveCmdBuilderTest.java index 6f89c67..81064dc 100644 --- a/job/src/test/java/org/apache/kylin/job/HiveCmdBuilderTest.java +++ b/job/src/test/java/org/apache/kylin/job/HiveCmdBuilderTest.java @@ -76,5 +76,7 @@ public class HiveCmdBuilderTest extends LocalFileMetadataTestCase { String hqlFile = cmd.substring(cmd.lastIndexOf("-f ") + 3).trim(); String hqlStatement = FileUtils.readFileToString(new File(hqlFile)); assertEquals("USE default;\nDROP TABLE test;\nSHOW\n TABLES;\n", hqlStatement); + + FileUtils.forceDelete(new File(hqlFile)); } }