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

impala-shell converts newlines to spaces in multi-line literals

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • Impala 2.0
    • None
    • Clients
    • I'm using the latest 2.0 build.

    Description

      Now that impala-shell doesn't get confused by a line with an unbalanced single quote, I tried inserting a multi-line string literal. Looks like impala-shell normalizes all newlines (even inside string literals) to spaces before sending to the back end:

      [localhost:21000] > create table string_t (s string);
      [localhost:21000] > insert into string_t values ('hello
      > world');
      [localhost:21000] > select * from string_t;
      -------------

      s

      -------------

      hello world

      -------------

      I'm expecting behavior similar to MySQL, where even if the newline causes the query output to be formatted weirdly, it still preserves the newline:

      mysql> create table string_t (s varchar(64));
      Query OK, 0 rows affected (0.06 sec)
      mysql> insert into string_t values ('hello
      '> world');
      Query OK, 1 row affected (0.00 sec)
      mysql> select * from string_t;
      -------------

      s

      -------------

      hello
      world

      -------------
      1 row in set (0.00 sec)

      When I cursor up in impala-shell, back to the INSERT...VALUES statement, the line-recalling code also turns the newline back into a space:

      [localhost:21000] > insert into string_t values ('hello world');

      MySQL's readline behavior is to only show that part of the line up to the newline:

      ...cursor up...
      mysql> world');
      ...cursor up...
      mysql> insert into string_t values ('hello

      They must be special-casing multi-line literals because if I split some other kind of statement over multiple lines, it does join them into one line when recalling the statement:

      mysql> create table
      -> foo (x int);
      Query OK, 0 rows affected (0.04 sec)
      ...cursor up...
      mysql> create table foo (x int);

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: