Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9168

Vectorized Coalesce for strings is broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.13.0, 0.14.0
    • 1.0.0
    • Vectorization
    • None

    Description

      Vectorized Coalesce uses BytesColumnVector.setElement which does not set the output string length correctly.

      create table str_str_orc (str1 string, str2 string) stored as orc;
      
      insert into table str_str_orc values (null, "X"), ("0", "X"), ("1", "X"), (null, "y");
      
      EXPLAIN
      SELECT
         str2, ROUND(sum(cast(COALESCE(str1, 0) as int))/60, 2) as result
      from str_str_orc
      GROUP BY str2;
      
      SELECT
         str2, ROUND(sum(cast(COALESCE(str1, 0) as int))/60, 2) as result
      from str_str_orc
      GROUP BY str2;
      
      EXPLAIN
      SELECT COALESCE(str1, 0) as result
      from str_str_orc;
      
      SELECT COALESCE(str1, 0) as result
      from str_str_orc;
      

      Produces different results when vectorized and not vectorized.

      Attachments

        1. HIVE-9168.01.patch
          13 kB
          Matt McCline
        2. HIVE-9168.02.patch
          25 kB
          Matt McCline

        Activity

          People

            mmccline Matt McCline
            mmccline Matt McCline
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: