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

Improve error message / fallback behavior for impala-shell queries involving tabs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 1.2.3
    • Impala 4.0.0
    • Clients
    • None

    Description

      When a query in impala-shell refers to a string literal, the shell stops using pretty-printed output, with a message like so:

      [localhost:21000] > select 'a\tb';
      Prettytable cannot resolve string columns values that have embedded tabs. Reverting to tab delimited text output
      a b

      I suggest taking out the reference to 'prettytable' as that's an implementation detail. The second part of the message should also use a hyphen 'tab-delimited' and end with a period.

      The same applies if the query itself doesn't contain any tabs, but the result set does:

      [localhost:21000] > create table embedded_tabs (s string);
      [localhost:21000] > insert into table embedded_tabs values ('abc\t123'),('xyz\t456');
      [localhost:21000] > select * from embedded_tabs;
      Prettytable cannot resolve string columns values that have embedded tabs. Reverting to tab delimited text output
      abc 123
      xyz 456

      Is tab-delimited text really the right fallback behavior though? Then there's no way to distinguish between a tab that really was in the data and one added by impala-shell as a separator. For example, here each row of the result set has 2 fields, but in 2 out of 3 rows there's a tab in the output too. The actual fields don't line up underneath each other, and the final row with no tab looks like a field is missing.

      [localhost:21000] > alter table embedded_tabs replace columns (s1 string, s2 string);
      [localhost:21000] > insert overwrite table embedded_tabs values ('hello world','abc\t123'),('xyz\t456','foo bar'),('bletch','baz');
      [localhost:21000] > select * from embedded_tabs;
      Prettytable cannot resolve string columns values that have embedded tabs. Reverting to tab delimited text output
      hello world abc 123
      xyz 456 foo bar
      bletch baz

      When output includes tabs, should the shell fall back to some different separator like pipe, so that the fields with embedded tabs could be seen and parsed correctly? (I realize that choosing a different separator opens up a new can of worms if the output includes the new separator too.)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jrussell John Russell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: