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

Vectorization: CASE result type casting

    Details

      Description

      create temporary table foo(q548284 int);
      insert into foo values(1),(2),(3),(4),(5),(6);
      select q548284, CASE WHEN ((q548284 = 1)) THEN (0.2) WHEN ((q548284 = 2)) THEN (0.4) WHEN ((q548284 = 3)) THEN (0.6) WHEN ((q548284 = 4)) THEN (0.8) WHEN ((q548284 = 5)) THEN (1) ELSE (null) END from foo order by q548284 limit 1;
      

      Fails with

      Caused by: java.lang.ClassCastException: org.apache.hadoop.hive.ql.exec.vector.LongColumnVector cannot be cast to org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector
              at org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector.setElement(DecimalColumnVector.java:130)
              at org.apache.hadoop.hive.ql.exec.vector.expressions.IfExprColumnNull.evaluate(IfExprColumnNull.java:101)
      

      This gets fixed if the case return of (1) is turned into a (1.0).

        Attachments

        1. HIVE-21742.6.patch
          255 kB
          Vineet Garg
        2. HIVE-21742.5.patch
          325 kB
          Vineet Garg
        3. HIVE-21799.4.patch
          356 kB
          Vineet Garg
        4. HIVE-21742.4.patch
          357 kB
          Vineet Garg
        5. HIVE-21742.3.patch
          357 kB
          Vineet Garg
        6. HIVE-21742.2.patch
          270 kB
          Vineet Garg
        7. HIVE-21742.1.patch
          19 kB
          Vineet Garg

          Issue Links

            Activity

              People

              • Assignee:
                vgarg Vineet Garg
                Reporter:
                gopalv Gopal V
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m