Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-4160 Vectorized Query Execution in Hive
  3. HIVE-4681

Fix ORC TimestampTreeReader.nextVector() to handle milli-nano math corectly

    XMLWordPrintableJSON

Details

    • Fix ORC TimestampTreeReader to sum the second and nanosecond fraction timestamp vectors correctly
    • vectorization

    Description

      The current TimestampTreeReader implementation is broken when fed only milliseconds.

      If TS = 222ms.

         result.vector[i] = ... // == 0;
         nanoVector.vector[i] = ... // == 222000000
         if (result.vector[i] >= 0) {
           result.vector[i] += nanoVector.vector[i] / 1000000; // 222
         }
      ...
         result.vector[i] = (result.vector[i] * 1000000)
                      + nanoVector.vector[i];
         // result.vector[i] == 444000000
      

      which is broken.

      This is not a problem in the Timestamp case, because

      ts.setTime(222);        // {time=0; nanos=222000000}
      ts.setNanos(222000000); // {time=0; nanos=222000000}
      

      Since that is not additive, the error does not occur in the regular ORC reader.

      Attachments

        1. HIVE-4681-001.patch
          3 kB
          Gopal Vijayaraghavan

        Issue Links

          Activity

            People

              gopalv Gopal Vijayaraghavan
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: