PyHive 在异步模式下运行 Hive 查询时遇到了一个奇怪的问题。在内部,PyHive 使用 Thrift 客户端来执行查询和获取日志(以及执行状态)。我无法获取 Hive 查询的日志(map/reduce 任务等)。cursor.fetch_logs()
返回一个空的数据结构
这是代码片段
rom pyhive import hive # or import hive or import trino
from TCLIService.ttypes import TOperationState
def run():
cursor = hive.connect(host="10.x.y.z", port='10003', username='xyz', password='xyz', auth='LDAP').cursor()
cursor.execute("select count(*) from schema1.table1 where date = '2021-03-13' ", async_=True)
status = cursor.poll(True).operationState
print(status)
while status in (TOperationState.INITIALIZED_STATE, TOperationState.RUNNING_STATE):
logs = cursor.fetch_logs()
for message in logs:
print("running ")
print(message)
# If needed, an asynchronous query can be cancelled at any time with:
# cursor.cancel()
print("running ")
status = cursor.poll().operationState
print
cursor.fetchall()
游标能够正确获取 operationState 但无法获取日志。HiveServer2 端有什么需要配置的吗?
提前致谢