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

Incorrect length when multiple CHAR(N) values are inserted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • Frontend
    • ghx-label-11

    Description

      To reproduce:

      CREATE TABLE impala_char_insert (s STRING);
      
      -- all values are CHAR(N) with different N, but all will use the biggest N
      INSERT OVERWRITE impala_char_insert VALUES (CAST("1" AS CHAR(1))), (CAST("12" AS CHAR(2))), (CAST("123" AS CHAR(3)));
      SELECT length(s) FROM impala_char_insert;
      results:
      3
      3
      3
      
      -- inserting the same values in separate INSERTs works correctly
      INSERT OVERWRITE impala_char_insert VALUES (CAST("1" AS CHAR(1)));
      INSERT INTO impala_char_insert VALUES (CAST("12" AS CHAR(2)));
      INSERT INTO impala_char_insert VALUES (CAST("123" AS CHAR(3)));
      SELECT length(s) FROM impala_char_insert;
      results:
      1
      2
      3
      
      -- if one value is not CHAR(N), then the lengths are correct
      INSERT OVERWRITE impala_char_insert VALUES (CAST("1" AS CHAR(1))), (CAST("12" AS VARCHAR(2))), (CAST("123" AS CHAR(3)));
      SELECT length(s) FROM impala_char_insert;
      results:
      1
      2
      3
      

      Attachments

        Activity

          People

            daniel.becker Daniel Becker
            csringhofer Csaba Ringhofer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: