diff --git a/shell/shell_output.py b/shell/shell_output.py index 1be2ab5..f7dbb71 100644 --- a/shell/shell_output.py +++ b/shell/shell_output.py @@ -28,7 +28,7 @@ class PrettyOutputFormatter(object): self.prettytable.clear_rows() try: map(self.prettytable.add_row, rows) - return self.prettytable.get_string() + return self.prettytable.get_string().encode('utf-8') except Exception, e: # beeswax returns each row as a tab separated string. If a string column # value in a row has tabs, it will break the row split. Default to displaying diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py index bab959d..c0fb7dd 100644 --- a/tests/shell/test_shell_commandline.py +++ b/tests/shell/test_shell_commandline.py @@ -343,6 +343,16 @@ class TestImpalaShell(object): assert RUSSIAN_CHARS.encode('utf-8') in result.stdout @pytest.mark.execute_serially + def test_international_characters_prettyprint(self): + """Regression test for IMPALA-2717""" + RUSSIAN_CHARS = (u"А, Б, В, Г, Д, Е, Ё, Ж, З, И, Й, К, Л, М, Н, О, П, Р," + u"С, Т, У, Ф, Х, Ц,Ч, Ш, Щ, Ъ, Ы, Ь, Э, Ю, Я") + args = """-q "select '%s'" """ % RUSSIAN_CHARS + result = run_impala_shell_cmd(args.encode('utf-8')) + assert 'UnicodeDecodeError' not in result.stderr + assert RUSSIAN_CHARS.encode('utf-8') in result.stdout + + @pytest.mark.execute_serially def test_config_file(self): """Test the optional configuration file""" # Positive tests