David Knupp has posted comments on this change. ( http://gerrit.cloudera.org:8080/15132 )
Change subject: IMPALA-3343: Make impala-shell compatible with python 3. ...................................................................... Patch Set 17: (1 comment) http://gerrit.cloudera.org:8080/#/c/15132/15/tests/shell/test_shell_commandline.py File tests/shell/test_shell_commandline.py: http://gerrit.cloudera.org:8080/#/c/15132/15/tests/shell/test_shell_commandline.py@485 PS15, Line 485: if SHELL_IS_PYTHON_2: > Still digging into this. The proposed change of cname.decode('utf8') fails Just a note to let you know this hasn't been languishing. I'm stuck in a weird loop that I'm still trying to figure out. It turns out that your suggestion was definitely on the right path after all. What was misleading We seem to need to call decode('utf-8') in python 2, and forego in python 3. I also needed to revert a change I had made to https://github.com/apache/impala/blob/master/shell/impala_shell.py#L1221 -- essentially, we need to do the same thing. I've confirmed that with those changes, on both py2 and py3, the intended behavior works. Here's an example with a smaller set of chars. $ impala-shell.sh -q "select '?, ?, ?, ?, ?, ?, ?'" Starting Impala with no authentication using Python 2.7.12 Opened TCP connection to localhost:21000 Connected to localhost:21000 Server version: impalad version 3.4.0-SNAPSHOT DEBUG (build b0634b1341f6189b8c7e0c1ba4cce810e947c52a) Query: select '?, ?, ?, ?, ?, ?, ?' Query submitted at: 2020-03-06 11:26:31 (Coordinator: http://dknupp-desktop:25000) Query progress can be monitored at: http://dknupp-desktop:25000/query_plan? query_id=b54072afd6be4181:9ea5acc200000000 +-----------------------+ | '?, ?, ?, ?, ?, ?, ?' | +-----------------------+ | ?, ?, ?, ?, ?, ?, ? | +-----------------------+ Fetched 1 row(s) in 0.12s And it works interactively. $ impala-shell.sh Starting Impala with no authentication using Python 2.7.12 Opened TCP connection to localhost:21000 Connected to localhost:21000 Server version: impalad version 3.4.0-SNAPSHOT DEBUG (build b0634b1341f6189b8c7e0c1ba4cce810e947c52a) *********************************************************************************** Welcome to the Impala shell. (Impala Shell v3.4.0-SNAPSHOT (b0634b1) built on Fri Feb 21 13:49:48 PST 2020) Press TAB twice to see a list of available commands. *********************************************************************************** [localhost:21000] default> select '?, ?, ?, ?, ?, ?, ?'; Query: select '?, ?, ?, ?, ?, ?, ?' Query submitted at: 2020-03-06 11:31:23 (Coordinator: http://dknupp-desktop:25000) Query progress can be monitored at: http://dknupp-desktop:25000/query_plan? query_id=8b4b4528051650f5:9520650700000000 +-----------------------+ | '?, ?, ?, ?, ?, ?, ?' | +-----------------------+ | ?, ?, ?, ?, ?, ?, ? | +-----------------------+ Fetched 1 row(s) in 0.12s [localhost:21000] default> However (and ignoring the added complication of tabs being present), test_international_characters_prettyprint is now failing with a UnicodeDecodeError. On the other hand, that test is passing on my original version -- but then actual usage fails. It's weird. -- To view, visit http://gerrit.cloudera.org:8080/15132 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibb75e162bac0faeae3e12106c15da39cbfb8b462 Gerrit-Change-Number: 15132 Gerrit-PatchSet: 17 Gerrit-Owner: David Knupp <dkn...@cloudera.com> Gerrit-Reviewer: David Knupp <dkn...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com> Gerrit-Comment-Date: Fri, 06 Mar 2020 19:33:24 +0000 Gerrit-HasComments: Yes