Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-11315

TestImpalaShellInteractive.test_multiline_queries_in_history fails with python3

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 4.1.0
    • Impala 4.2.0, Impala 4.1.1
    • Clients
    • None
    • ghx-label-13

    Description

      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:

      >       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         '
      

      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

      Attachments

        Issue Links

          Activity

            People

              joemcdonnell Joe McDonnell
              joemcdonnell Joe McDonnell
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: