You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bo...@apache.org on 2020/09/08 10:12:26 UTC
[impala] 03/05: Revert "IMPALA-10012: ds_hll_sketch() results ascii
codec decoding error fix"
This is an automated email from the ASF dual-hosted git repository.
boroknagyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit b7965d8240f3a5cd6972351b7fe1116e4a0835c1
Author: Csaba Ringhofer <cs...@cloudera.com>
AuthorDate: Fri Sep 4 12:27:58 2020 +0000
Revert "IMPALA-10012: ds_hll_sketch() results ascii codec decoding error fix"
This reverts commit 75146c9138051758176d3d4482f45a9d1056127b.
Change-Id: I57f790389a8c847877999d2b9b8185939b416c07
Reviewed-on: http://gerrit.cloudera.org:8080/16417
Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
Tested-by: Csaba Ringhofer <cs...@cloudera.com>
---
shell/impala_client.py | 10 +---------
shell/impala_shell.py | 11 +----------
shell/shell_output.py | 21 +++------------------
3 files changed, 5 insertions(+), 37 deletions(-)
diff --git a/shell/impala_client.py b/shell/impala_client.py
index 19a570f..cb7cb39 100755
--- a/shell/impala_client.py
+++ b/shell/impala_client.py
@@ -1095,15 +1095,7 @@ class ImpalaBeeswaxClient(ImpalaClient):
self.fetch_size))
if rpc_status != RpcStatus.OK:
raise RPCException()
-
- def split_row_and_decode_if_needed(row):
- try:
- return row.split('\t')
- except UnicodeDecodeError:
- return row.decode('utf-8', 'replace').split('\t')
-
- yield [split_row_and_decode_if_needed(row) for row in result.data]
-
+ yield [row.split('\t') for row in result.data]
if not result.has_more:
return
diff --git a/shell/impala_shell.py b/shell/impala_shell.py
index 6cb9aa7..8c18408 100755
--- a/shell/impala_shell.py
+++ b/shell/impala_shell.py
@@ -1221,15 +1221,6 @@ class ImpalaShell(cmd.Cmd, object):
except RPCException as e:
# could not complete the rpc successfully
print(e, file=sys.stderr)
- except UnicodeDecodeError as e:
- # An error occoured possibly during the fetching.
- # Depending of which protocol is at use it can come from different places.
- # Possibly occours because we try to display binary data which contains
- # undecodable elements.
- if self.last_query_handle is not None:
- self.imp_client.close_query(self.last_query_handle)
- print('UnicodeDecodeError : %s \nPlease check for columns containing binary data '
- 'to find the possible source of the error.' % (e,), file=sys.stderr)
except QueryStateException as e:
# an exception occurred while executing the query
if self.last_query_handle is not None:
@@ -1357,7 +1348,7 @@ class ImpalaShell(cmd.Cmd, object):
if self.readline and self.readline.get_current_history_length() > 0:
for index in xrange(1, self.readline.get_current_history_length() + 1):
cmd = self.readline.get_history_item(index)
- print('[%d]: %s' % (index, cmd.decode('utf-8', 'replace')), file=sys.stderr)
+ print('[%d]: %s' % (index, cmd), file=sys.stderr)
else:
print(READLINE_UNAVAILABLE_ERROR, file=sys.stderr)
diff --git a/shell/shell_output.py b/shell/shell_output.py
index 31d91a0..c6c2e99 100644
--- a/shell/shell_output.py
+++ b/shell/shell_output.py
@@ -35,25 +35,11 @@ class PrettyOutputFormatter(object):
def format(self, rows):
"""Returns string containing representation of the table data."""
-
- def decode_if_needed(row):
- # Checking if the values in row is decodable. If it is we just give back the row
- # as it is, if not we generate a new row and give that back instead where the
- # undecodable parts are swapped out.
- try:
- ''.join(str(row))
- return row
- except UnicodeDecodeError:
- new_row = []
- for entry in row:
- new_row.append(entry.decode('UTF-8', 'replace'))
- return new_row
-
# Clear rows that already exist in the table.
self.prettytable.clear_rows()
try:
for row in rows:
- self.prettytable.add_row(decode_if_needed(row))
+ self.prettytable.add_row(row)
return self.prettytable.get_string()
except Exception as e:
# beeswax returns each row as a tab separated string. If a string column
@@ -63,8 +49,7 @@ class PrettyOutputFormatter(object):
"embedded tabs. Reverting to tab delimited text output")
print(error_msg, file=sys.stderr)
print('{0}: {1}'.format(type(e), str(e)), file=sys.stderr)
-
- return '\n'.join(['\t'.join(decode_if_needed(row)) for row in rows])
+ return '\n'.join(['\t'.join(row) for row in rows])
class DelimitedOutputFormatter(object):
@@ -92,7 +77,7 @@ class DelimitedOutputFormatter(object):
lineterminator='\n', quoting=csv.QUOTE_MINIMAL)
for row in rows:
if sys.version_info.major == 2:
- row = [val.encode('utf-8', 'replace') for val in row]
+ row = [val.encode('utf-8') for val in row]
writer.writerow(row)
rows = temp_buffer.getvalue().rstrip()
temp_buffer.close()