[
https://issues.apache.org/jira/browse/IMPALA-11315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542267#comment-17542267
]
ASF subversion and git services commented on IMPALA-11315:
----------------------------------------------------------
Commit 0ee5f8084f1bb34fc261c729f736ac093ba59c41 in impala's branch
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=0ee5f8084 ]
IMPALA-11317/IMPALA-11316/IMPALA-11315: impala-shell Python 3 fixes
This fixes a few impala-shell Python 3 issues:
1. In ImpalaShell's do_history(), the decode() call needs to be
avoided in Python 3, because in Python 3 the cmd is already
a string and doesn't need further decoding. (IMPALA-11315)
2. TestImpalaShell.test_http_socket_timeout() gets a different
error message in Python 3. It throws the "BlockingIOError"
rather than "socker.error". (IMPALA-11316)
3. ImpalaHttpClient.py's code to retrieve the body when
handling an HTTP error needs to have a decode() call
for the body. Otherwise, the body remains bytes and
causes TestImpalaShellInteractive.test_http_interactions_extra()
to fail. (IMPALA-11317)
Testing:
- Ran shell tests in the standard way
- Ran shell tests with the impala-shell executable coming from
a Python 3 virtualenv using the PyPi package
Change-Id: Ie58380a17d7e011f4ce96b27d34717509a0b80a6
Reviewed-on: http://gerrit.cloudera.org:8080/18556
Reviewed-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Wenzhe Zhou <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> TestImpalaShellInteractive.test_multiline_queries_in_history fails with
> python3
> -------------------------------------------------------------------------------
>
> Key: IMPALA-11315
> URL: https://issues.apache.org/jira/browse/IMPALA-11315
> Project: IMPALA
> Issue Type: Bug
> Components: Clients
> Affects Versions: Impala 4.2.0
> Reporter: Joe McDonnell
> Assignee: Joe McDonnell
> Priority: Major
>
> When running the shell tests with a python 3 impala-shell (pip installed into
> virtual), TestImpalaShellInteractive.test_multiline_queries_in_history and
> other tests fail with this message:
> {noformat}
> > assert history_entry in result.stderr, "'%s' not in '%s'" %
> > (history_entry,
>
> result.stderr)
> E AssertionError: '[1]: select
> E 1;--comment' not in 'Server version: impalad version 4.1.0-SNAPSHOT
> DEBUG (build b7ed6dea96e72f601c123c49e73dbe2be274ba5a)
> E Traceback (most recent call last):
> E File "/home/joe/view2/Impala/shellvenv/bin/impala-shell", line
> 11, in <module>
> E load_entry_point('impala-shell==4.1.0.dev20220523103714',
> 'console_scripts', 'impala-shell')()
> E File
> "/home/joe/view2/Impala/shellvenv/lib/python3.6/site-packages/impala_shell/impala_shell.py",
> line 2107, in impala_shell_main
> E shell.cmdloop(intro)
> E File "/usr/lib/python3.6/cmd.py", line 138, in cmdloop
> E stop = self.onecmd(line)
> E File
> "/home/joe/view2/Impala/shellvenv/lib/python3.6/site-packages/impala_shell/impala_shell.py",
> line 740, in onecmd
> E return func(arg)
> E File
> "/home/joe/view2/Impala/shellvenv/lib/python3.6/site-packages/impala_shell/impala_shell.py",
> line 1506, in do_history
> E print('[%d]: %s' % (index, cmd.decode('utf-8', 'replace')),
> file=sys.stderr)
> E AttributeError: 'str' object has no attribute 'decode'
> E '
> {noformat}
> It looks like we are trying to call decode() on a str. For Python 3, we
> should avoid the decode in do_history() here:
> https://github.com/apache/impala/blob/master/shell/impala_shell.py#L1506
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]