我正在尝试使用impyla
使用Tez连接到Hive 0.14服务器:
from impala.dbapi import connect
from impala.utils import to_pandas
connection = connect(host='myhost', port=10000, auth_mechanism='PLAIN')
cursor = connection.cursor(configuration={'job.queue.name':'myqueue'})
cursor.execute('show databases') # works ok
cursor.fetchall() # works ok
cursor.execute('select field1, field2 from mydb.mytable where field1 > 2015') # breaks!
df = to_pandas(cursor) # never gets here
错误:
HiveServer2Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask
发生了什么事?似乎没有使用configuration
。
答案 0 :(得分:0)
Impyla实现了Python database API。查看文档,看起来cursor()
方法不接受任何参数。但是,execute()
takes a configuration
kwarg。尝试:
cursor.execute('select field1, field2 from mydb.mytable where field1 > 2015', configuration={'job.queue.name':'myqueue'})