You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/07/26 04:43:22 UTC
[incubator-superset] branch master updated: fix hive.fetch_logs
(#2968)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 6045063 fix hive.fetch_logs (#2968)
6045063 is described below
commit 6045063e786caef8a1692c0504d4cfb19e42ddde
Author: timfeirg <kk...@gmail.com>
AuthorDate: Wed Jul 26 12:43:19 2017 +0800
fix hive.fetch_logs (#2968)
---
superset/db_engine_specs.py | 6 +++---
superset/db_engines/hive.py | 14 ++++++++------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index d4a7fa0..b460226 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -723,9 +723,9 @@ class HiveEngineSpec(PrestoEngineSpec):
cursor.cancel()
break
- resp = cursor.fetch_logs()
- if resp and resp.log:
- progress = cls.progress(resp.log)
+ logs = cursor.fetch_logs()
+ if logs:
+ progress = cls.progress(logs)
if progress > query.progress:
query.progress = progress
session.commit()
diff --git a/superset/db_engines/hive.py b/superset/db_engines/hive.py
index d3244fe..a31b4d7 100644
--- a/superset/db_engines/hive.py
+++ b/superset/db_engines/hive.py
@@ -1,5 +1,6 @@
from pyhive import hive
from pythrifthiveapi.TCLIService import ttypes
+from thrift import Thrift
# TODO: contribute back to pyhive.
@@ -15,9 +16,11 @@ def fetch_logs(self, max_rows=1024,
"""
try:
req = ttypes.TGetLogReq(operationHandle=self._operationHandle)
- logs = self._connection.client.GetLog(req)
+ logs = self._connection.client.GetLog(req).log
return logs
- except ttypes.TApplicationException as e: # raised if Hive is used
+ # raised if Hive is used
+ except (ttypes.TApplicationException,
+ Thrift.TApplicationException):
if self._state == self._STATE_NONE:
raise hive.ProgrammingError("No query yet")
logs = []
@@ -30,12 +33,11 @@ def fetch_logs(self, max_rows=1024,
)
response = self._connection.client.FetchResults(req)
hive._check_status(response)
- assert not (
- response.results.rows, 'expected data in columnar format'
- )
+ assert not response.results.rows, \
+ 'expected data in columnar format'
assert len(response.results.columns) == 1, response.results.columns
new_logs = hive._unwrap_column(response.results.columns[0])
logs += new_logs
if not new_logs:
break
- return logs
+ return '\n'.join(logs)
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].