0

我使用beeline cli和pyhive访问hives thrift server 3.1.2,运行查询而不运行进度返回,但是当我使用hive server 2时。

我的 python 版本是 2.7.x 并使用 pyhive 驱动程序

    try:
       cursor.execute(_sql, async=True)
 
       status = cursor.poll().operationState
       while status not in (TOperationState.FINISHED_STATE, TOperationState.CANCELED_STATE, TOperationState.CLOSED_STATE, TOperationState.ERROR_STATE):
           logs = cursor.fetch_logs()
           for message in logs:
               #print message
               pass
    
           status = cursor.poll().operationState
           print "xxxxxxxxxxxxxx"
           pprint.pprint(status)
           print "xxxxxxxxxxxxxx"
           if status in (TOperationState.ERROR_STATE, 5):
               logs=cursor.fetch_logs()
               real_log=''
               #print "xxx"
               #pass
               for _log in logs:
                   if "INFO" not in _log:
                       if "Caused by" in _log or "ERROR" in _log:
                           real_log = real_log + "\n" + _log
               print real_log
               print "xxx"
               #raise Exception(real_log)

4

0 回答 0