Hive
  1. Hive
  2. HIVE-1955

Support non-constant expressions for array indexes.

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: None
    • Labels:
      None

      Description

      FAILED: Error in semantic analysis: line 4:8 Non Constant Expressions for Array Indexes not Supported dut

      ...just wrote my own UDF to do this, and it is trivial. We should support this natively.

      Let foo have these rows:
      arr i
      [1,2,3] 1
      [3,4,5] 2
      [5,4,3] 2
      [0,0,1] 0

      Then,
      SELECT arr[i] FROM foo
      should return:
      2
      5
      3
      1

      Similarly, for the same table,
      SELECT 3 IN arr FROM foo
      should return:
      true
      true
      true
      false

      ...these use cases are needless limitations of functionality. We shouldn't need UDFs to accomplish these goals.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          1424d 3h 6m 1 Navis 29/Dec/14 02:33
          Ashutosh Chauhan made changes -
          Fix Version/s 0.14.0 [ 12326450 ]
          Navis made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Navis made changes -
          Link This issue Is contained by HIVE-7325 [ HIVE-7325 ]
          Navis made changes -
          Assignee Navis [ navis ]
          Mala Chikka Kempanna made changes -
          Link This issue relates to HIVE-7325 [ HIVE-7325 ]
          Hide
          Navis added a comment -

          Is there any reason index value should be constant?

          Show
          Navis added a comment - Is there any reason index value should be constant?
          Adam Kramer made changes -
          Field Original Value New Value
          Description FAILED: Error in semantic analysis: line 4:8 Non Constant Expressions for Array Indexes not Supported dut

          ...just wrote my own UDF to do this, and it is trivial. We should support this natively.
          FAILED: Error in semantic analysis: line 4:8 Non Constant Expressions for Array Indexes not Supported dut

          ...just wrote my own UDF to do this, and it is trivial. We should support this natively.

          Let foo have these rows:
          arr i
          [1,2,3] 1
          [3,4,5] 2
          [5,4,3] 2
          [0,0,1] 0

          Then,
          SELECT arr[i] FROM foo
          should return:
          2
          5
          3
          1

          Similarly, for the same table,
          SELECT 3 IN arr FROM foo
          should return:
          true
          true
          true
          false

          ...these use cases are needless limitations of functionality. We shouldn't need UDFs to accomplish these goals.
          Hide
          Adam Kramer added a comment -

          Also, IN should operate on non-constant arrays.

          Show
          Adam Kramer added a comment - Also, IN should operate on non-constant arrays.
          Adam Kramer created issue -

            People

            • Assignee:
              Navis
              Reporter:
              Adam Kramer
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development