From 0560c845e4d9c822850fd45276f642d23a8bef78 Mon Sep 17 00:00:00 2001 From: Denes Bodo Date: Fri, 3 May 2019 13:11:02 +0200 Subject: [PATCH] SQOOP-3423 Let user pass password to connect Hive when it set to LDAP authentication Amendum commit. Enabling usage of empy password and mentioning LDAP auth in hive.txt Change-Id: I102ab6e520fcd0f0030106300c90c86f3ccfc7f9 --- src/docs/user/hive.txt | 2 +- .../hive/HiveServer2ConnectionFactoryInitializer.java | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/docs/user/hive.txt b/src/docs/user/hive.txt index 979e7afc..59d9b009 100644 --- a/src/docs/user/hive.txt +++ b/src/docs/user/hive.txt @@ -48,7 +48,7 @@ Sqoop will use +$HIVE_HOME/bin/hive+ from here. will not be transferred via the JDBC connection it is written directly to HDFS just like in case of the default hive import. As HiveServer2 provides proper authorization and auditing features it is recommended to use this instead of - the default. Currently only Kerberos authentication and text file format is + the default. Currently only Kerberos and LDAP authentication and text file format is supported with this option. NOTE: This function is incompatible with +\--as-avrodatafile+ and diff --git a/src/java/org/apache/sqoop/hive/HiveServer2ConnectionFactoryInitializer.java b/src/java/org/apache/sqoop/hive/HiveServer2ConnectionFactoryInitializer.java index e2600d45..adb25593 100644 --- a/src/java/org/apache/sqoop/hive/HiveServer2ConnectionFactoryInitializer.java +++ b/src/java/org/apache/sqoop/hive/HiveServer2ConnectionFactoryInitializer.java @@ -34,7 +34,7 @@ public class HiveServer2ConnectionFactoryInitializer { public JdbcConnectionFactory createJdbcConnectionFactory(SqoopOptions sqoopOptions) { String connectionUsername = determineConnectionUsername(sqoopOptions); - String connectionPassword = determineConnectionPassword(sqoopOptions); + String connectionPassword = sqoopOptions.getHs2Password(); JdbcConnectionFactory connectionFactory = new HiveServer2ConnectionFactory( sqoopOptions.getHs2Url(), connectionUsername, @@ -57,13 +57,6 @@ private String determineConnectionUsername(SqoopOptions sqoopOptions) { } } - private String determineConnectionPassword(SqoopOptions sqoopOptions) { - if (!isEmpty(sqoopOptions.getHs2Password())) { - return sqoopOptions.getHs2Password(); - } - return null; - } - private KerberosAuthenticator createKerberosAuthenticator(SqoopOptions sqoopOptions) { return new KerberosAuthenticator(sqoopOptions.getConf(), sqoopOptions.getHs2User(), sqoopOptions.getHs2Keytab()); }