You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/05/05 11:30:10 UTC
[kylin] branch master updated: Read password from file for Beeline
(#582)
This is an automated email from the ASF dual-hosted git repository.
nic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push:
new aab2b90 Read password from file for Beeline (#582)
aab2b90 is described below
commit aab2b90197cb58408ee808da3f83045248784a86
Author: DekarLab <de...@users.noreply.github.com>
AuthorDate: Sun May 5 13:30:04 2019 +0200
Read password from file for Beeline (#582)
* Read password from file for Beeline
Activate option -w password file for beeline for kylin.
Example:
https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients
% beeline -u jdbc:hive2://localhost:10000/default -n scott -w password_file
---
.../org/apache/kylin/source/hive/BeelineHiveClient.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
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 6efe4ec..7f1f61d 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
@@ -18,7 +18,12 @@
package org.apache.kylin.source.hive;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
@@ -60,6 +65,17 @@ public class BeelineHiveClient implements IHiveClient {
if ("-p".equals(splits[i])) {
password = stripQuotes(splits[i + 1]);
}
+ if ("-w".equals(splits[i])) {
+ File file = new File(splits[i + 1]);
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
+ password = br.readLine();
+ br.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
Properties jdbcProperties = SourceConfigurationUtil.loadHiveJDBCProperties();
jdbcProperties.put(HIVE_AUTH_PASSWD, password);