[ 
https://issues.apache.org/jira/browse/AIRFLOW-496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730891#comment-16730891
 ] 

jack commented on AIRFLOW-496:
------------------------------

The problem is not in Impala it's in Airflow.  Airflow uses Impala as a library 
so it should send parameters in the required format. 

I assume it's caused here:

https://github.com/apache/incubator-airflow/blob/master/airflow/hooks/hive_hooks.py#L766

> HiveServer2Hook invokes incorrect Auth mechanism when user not specified
> ------------------------------------------------------------------------
>
>                 Key: AIRFLOW-496
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-496
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: hive_hooks
>            Reporter: Shreyas Joshi
>            Assignee: Sandish Kumar HN
>            Priority: Major
>
> h3. Summary
> {{HiveServer2Hook}} Seems to be ignoring the auth_mechanism when the user is 
> not specified. I am not entirely sure if the solution should be should change 
> impyala or Airflow.
> h3. Reproducing the problem
> With this connection string for Hive: 
> {{AIRFLOW_CONN_GH_HIVE=hive2://@localhost:10000/}} (No user name and no 
> password)
>  I get the following error from {{HiveServer2hook}}:
> {code}
> from airflow.hooks import HiveServer2Hook
> hive_hook = HiveServer2Hook (hiveserver2_conn_id='GH_HIVE')
> {code}
> {noformat}
> [2016-09-08 14:30:52,420] {base_hook.py:53} INFO - Using connection to: 
> localhost
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/airflow/hooks/hive_hooks.py",
>  line 464, in get_conn
>     database=db.schema or 'default')
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/impala/dbapi.py",
>  line 147, in connect
>     auth_mechanism=auth_mechanism)
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/impala/hiveserver2.py",
>  line 658, in connect
>     transport.open()
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/thrift_sasl/__init__.py",
>  line 72, in open
>     message=("Could not start SASL: %s" % self.sasl.getError()))
> thriftpy.transport.TTransportException: TTransportException(type=1, 
> message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no 
> mechanism available: No worthy mechs found'")
> {noformat}
> h3. More detail
> [Here|https://github.com/apache/incubator-airflow/blob/master/airflow/hooks/hive_hooks.py#L591]
>  {{db.login}} ends up being an empty string rather than {{None}}. This seems 
> to cause impala to try sasl. Changing {{db.login}} from an empty string to 
> {{None}} seems to fix the issue. 
> So, the following does not work
> {code}
> from impala.dbapi import connect
> connect (host='localhost', port=10000, user='', auth_mechanism='PLAIN', 
> database= 'default')
> {code}
> The error is:
> {noformat}
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/impala/dbapi.py",
>  line 147, in connect
>     auth_mechanism=auth_mechanism)
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/impala/hiveserver2.py",
>  line 658, in connect
>     transport.open()
>   File 
> "/Users/shreyasjoshis/python-envs/default-env/lib/python3.5/site-packages/thrift_sasl/__init__.py",
>  line 72, in open
>     message=("Could not start SASL: %s" % self.sasl.getError()))
> thriftpy.transport.TTransportException: TTransportException(type=1, 
> message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no 
> mechanism available: No worthy mechs found'")
> {noformat}
> But the following does:
> {code}
> from impala.dbapi import connect
> connect (host='localhost', port=10000, user=None, auth_mechanism='PLAIN', 
> database= 'default')
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to