Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8639 )
Change subject: IMPALA-4664: Unexpected string conversion in Shell ...................................................................... Patch Set 4: (1 comment) http://gerrit.cloudera.org:8080/#/c/8639/4/shell/impala_shell.py File shell/impala_shell.py: http://gerrit.cloudera.org:8080/#/c/8639/4/shell/impala_shell.py@337 PS4, Line 337: def sanitise_input(self, args): > > I feel like all this string manipulation is very hard to reason about, le I agree it would be nice to have a minimal fix for the bug but I think using sqlparse here is a major change. The code is confusing enough now that it's hard to understand the consequences of making the change. I looked at the history of why we lower-case the first word. It seems like python cmd doesn't support case-insensitive routing of commands (e.g. "SeT foo=bar" -> do_set()). See https://docs.python.org/2/library/cmd.html . The lower-casing is a hack to try and force python to do what we want. I think the proper fix is to undo this hack and fix it properly by overriding default() and doing the dispatching ourselves. A possible minimal fix is to only lower-case the initial alphabetical characters in the input, instead of the whole first token. Python cmd only uses the initial alphanumeric characters to dispatch to a function: https://github.com/python/cpython/blob/2.7/Lib/cmd.py#L192 -- To view, visit http://gerrit.cloudera.org:8080/8639 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Iba6fa4e9ac570d22135ba51b844db8f9be965ca3 Gerrit-Change-Number: 8639 Gerrit-PatchSet: 4 Gerrit-Owner: Kim Jin Chul <jinc...@gmail.com> Gerrit-Reviewer: Gabor Kaszab <gaborkas...@cloudera.com> Gerrit-Reviewer: Kim Jin Chul <jinc...@gmail.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com> Gerrit-Reviewer: Zach Amsden <zams...@cloudera.com> Gerrit-Comment-Date: Mon, 11 Dec 2017 23:32:20 +0000 Gerrit-HasComments: Yes