|
33 | 33 | DEFAULT_QUERY = 'select 1'
|
34 | 34 | QUERY_FILE_PATH = os.path.join(os.environ['IMPALA_HOME'], 'tests', 'shell')
|
35 | 35 |
|
| 36 | +RUSSIAN_CHARS = (u"А, Б, В, Г, Д, Е, Ё, Ж, З, И, Й, К, Л, М, Н, О, П, Р," |
| 37 | + u"С, Т, У, Ф, Х, Ц,Ч, Ш, Щ, Ъ, Ы, Ь, Э, Ю, Я") |
36 | 38 |
|
37 | 39 | @pytest.fixture
|
38 | 40 | def empty_table(unique_database, request):
|
@@ -405,12 +407,27 @@ def test_get_log_once(self, empty_table):
|
405 | 407 |
|
406 | 408 | def test_international_characters(self):
|
407 | 409 | """Sanity test to ensure that the shell can read international characters."""
|
408 |
| - russian_chars = (u"А, Б, В, Г, Д, Е, Ё, Ж, З, И, Й, К, Л, М, Н, О, П, Р," |
409 |
| - u"С, Т, У, Ф, Х, Ц,Ч, Ш, Щ, Ъ, Ы, Ь, Э, Ю, Я") |
410 |
| - args = """-B -q "select '%s'" """ % russian_chars |
| 410 | + args = """-B -q "select '%s'" """ % RUSSIAN_CHARS |
411 | 411 | result = run_impala_shell_cmd(args.encode('utf-8'))
|
412 | 412 | assert 'UnicodeDecodeError' not in result.stderr
|
413 |
| - assert russian_chars.encode('utf-8') in result.stdout |
| 413 | + assert RUSSIAN_CHARS.encode('utf-8') in result.stdout |
| 414 | + |
| 415 | + def test_international_characters_prettyprint(self): |
| 416 | + """IMPALA-2717: ensure we can handle international characters in pretty-printed |
| 417 | + output""" |
| 418 | + args = """-q "select '%s'" """ % RUSSIAN_CHARS |
| 419 | + result = run_impala_shell_cmd(args.encode('utf-8')) |
| 420 | + assert 'UnicodeDecodeError' not in result.stderr |
| 421 | + assert RUSSIAN_CHARS.encode('utf-8') in result.stdout |
| 422 | + |
| 423 | + def test_international_characters_prettyprint_tabs(self): |
| 424 | + """IMPALA-2717: ensure we can handle international characters in pretty-printed |
| 425 | + output when pretty-printing falls back to delimited output.""" |
| 426 | + args = """-q "select '%s\\t'" """ % RUSSIAN_CHARS |
| 427 | + result = run_impala_shell_cmd(args.encode('utf-8')) |
| 428 | + assert 'Reverting to tab delimited text' in result.stderr |
| 429 | + assert 'UnicodeDecodeError' not in result.stderr |
| 430 | + assert RUSSIAN_CHARS.encode('utf-8') in result.stdout |
414 | 431 |
|
415 | 432 | @pytest.mark.execute_serially # This tests invalidates metadata, and must run serially
|
416 | 433 | def test_config_file(self):
|
|
0 commit comments