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

Vectorization: Case expressions that return BOOLEAN are not supported for FILTER

    XMLWordPrintableJSON

Details

    Description

      In cases like Query89, the vertex with the filter is not vectorized.

                         Filter Operator
                            predicate: CASE WHEN ((avg_window_0 <> 0.0D)) THEN (((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (null) END (type: boolean)
      
              Reducer 3 
                  Execution mode: llap
                  Reduce Vectorization:
                      enabled: true
                      enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true
                      notVectorizedReason: FILTER operator: Unexpected hive type name void
                      vectorized: false
      

      The query specifically has

      where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1
      

      while rewriting it to

      where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) > 0.1 else false end
      

      does vectorize into

                          Filter Operator
                            Filter Vectorization:
                                className: VectorFilterOperator
                                native: true
                                predicateExpression: SelectColumnIsTrue(col 12:boolean)(children: VectorUDFAdaptor(CASE WHEN ((avg_window_0 <> 0.0D)) THEN (((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (false) END)(children: DoubleColNotEqualDoubleScalar(col 7:double, val 0.0) -> 8:boolean, DoubleColGreaterDoubleScalar(col 9:double, val 0.1)(children: DoubleColDivideDoubleColumn(col 10:double, col 7:double)(children: FuncAbsDoubleToDouble(col 9:double)(children: DoubleColSubtractDoubleColumn(col 6:double, col 7:double) -> 9:double) -> 10:double) -> 9:double) -> 11:boolean) -> 12:boolean)
                            predicate: CASE WHEN ((avg_window_0 <> 0.0D)) THEN (((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (false) END (type: boolean)
                            Statistics: Num rows: 11 Data size: 5291 Basic stats: COMPLETE Column stats: COMPLETE
      

      Attachments

        1. HIVE-20277.02.patch
          52 kB
          Matt McCline
        2. HIVE-20277.03.patch
          52 kB
          Matt McCline
        3. HIVE-20277.04.patch
          52 kB
          Matt McCline
        4. HIVE-20277.WIP.01.patch
          5 kB
          Matt McCline

        Issue Links

          Activity

            People

              mmccline Matt McCline
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: