Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/17099 )

Change subject: IMPALA-10523: Fix impala-shell crash in printing error messages 
that contain UTF-8 characters
......................................................................

IMPALA-10523: Fix impala-shell crash in printing error messages that contain 
UTF-8 characters

In Python2, print() converts all non-keyword arguments to strings like
str() does and writes them to the stream. str() on QueryStateException
returns its value(i.e. error message) which could be in unicode type.
Python2 will implicitly encode it to str type using the default
encoding, 'ascii'. This could result in UnicodeEncodeError when there
are non-ascii characters in the error message.

This patch explicitly encodes the error message using 'utf-8' encoding
if it's in unicode type and the shell is run in Python2.

Tests:
 - Add test in test_shell_interactive.py

Change-Id: Ie10f5b03ecc5877053c2fbada1afaf256b423a71
Reviewed-on: http://gerrit.cloudera.org:8080/17099
Reviewed-by: Tamas Mate <[email protected]>
Reviewed-by: Laszlo Gaal <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M shell/impala_shell.py
M tests/shell/test_shell_interactive.py
2 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  Tamas Mate: Looks good to me, but someone else must approve
  Laszlo Gaal: Looks good to me, approved
  Impala Public Jenkins: Verified

--
To view, visit http://gerrit.cloudera.org:8080/17099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie10f5b03ecc5877053c2fbada1afaf256b423a71
Gerrit-Change-Number: 17099
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Laszlo Gaal <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Tamas Mate <[email protected]>

Reply via email to