Hive
  1. Hive
  2. HIVE-470

Support COALESCE using GenericUDF

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.4.0
    • Fix Version/s: 0.4.0
    • Component/s: Query Processor
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      See HIVE-164 for details. We should support COALESCE which is defined in SQL-92. This is kind of a syntax sugar, but it is used very frequently in full outer joins.

      1. HIVE-470.3.patch
        14 kB
        Zheng Shao
      2. HIVE-470.2.patch
        11 kB
        Zheng Shao
      3. HIVE-470.1.patch
        11 kB
        Zheng Shao

        Issue Links

          Activity

          Zheng Shao created issue -
          Zheng Shao made changes -
          Field Original Value New Value
          Link This issue depends on HIVE-45 [ HIVE-45 ]
          Hide
          Zheng Shao added a comment -

          This patch includes the code, one positive test and one negative test.

          Show
          Zheng Shao added a comment - This patch includes the code, one positive test and one negative test.
          Zheng Shao made changes -
          Attachment HIVE-470.1.patch [ 12409829 ]
          Zheng Shao made changes -
          Assignee Zheng Shao [ zshao ]
          Zheng Shao made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Hide
          Prasad Chakka added a comment -

          i don't see a test for all NULL args for COALESCE. MySQL supports that.

          Show
          Prasad Chakka added a comment - i don't see a test for all NULL args for COALESCE. MySQL supports that.
          Hide
          Prasad Chakka added a comment -

          also might want to remove @override tags which seem to be causing issues in some environments.

          Show
          Prasad Chakka added a comment - also might want to remove @override tags which seem to be causing issues in some environments.
          Hide
          Zheng Shao added a comment -

          This patch adds a case in which both arguments are NULL.
          We don't support COALESCE(NULL, NULL) because COALESCE cannot figure out the return type.

          I didn't remove "@Override". We have enough code that has this "@Override" for interface methods (supported by Java 1.6 but not Java 1.5)

          Show
          Zheng Shao added a comment - This patch adds a case in which both arguments are NULL. We don't support COALESCE(NULL, NULL) because COALESCE cannot figure out the return type. I didn't remove "@Override". We have enough code that has this "@Override" for interface methods (supported by Java 1.6 but not Java 1.5)
          Zheng Shao made changes -
          Attachment HIVE-470.2.patch [ 12410268 ]
          Hide
          Prasad Chakka added a comment -

          I don't see the new test case for COALESCE(NULL, NULL).

          how does mysql support it? does it type NULL to whatever type the rest of query expects it to be there in that column?

          Show
          Prasad Chakka added a comment - I don't see the new test case for COALESCE(NULL, NULL). how does mysql support it? does it type NULL to whatever type the rest of query expects it to be there in that column?
          Hide
          Namit Jain added a comment -

          Can you add a test where you are selecting from a table which contains null columns ?

          Show
          Namit Jain added a comment - Can you add a test where you are selecting from a table which contains null columns ?
          Hide
          Zheng Shao added a comment -

          Added a query from table.

          Show
          Zheng Shao added a comment - Added a query from table.
          Zheng Shao made changes -
          Attachment HIVE-470.3.patch [ 12410426 ]
          Hide
          Namit Jain added a comment -

          +1
          looks good - will commit if the tests pass

          Show
          Namit Jain added a comment - +1 looks good - will commit if the tests pass
          Hide
          Namit Jain added a comment -

          Committed. Thanks Zheng

          Show
          Namit Jain added a comment - Committed. Thanks Zheng
          Namit Jain made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags [Reviewed]
          Fix Version/s 0.4.0 [ 12313714 ]
          Resolution Fixed [ 1 ]
          Carl Steinbach made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Link This issue depends on HIVE-45 [ HIVE-45 ]
          Gavin made changes -
          Link This issue depends upon HIVE-45 [ HIVE-45 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Patch Available Patch Available
          29d 22h 58m 1 Zheng Shao 04/Jun/09 01:17
          Patch Available Patch Available Resolved Resolved
          7d 23h 56m 1 Namit Jain 12/Jun/09 01:13
          Resolved Resolved Closed Closed
          917d 23h 53m 1 Carl Steinbach 17/Dec/11 00:07

            People

            • Assignee:
              Zheng Shao
              Reporter:
              Zheng Shao
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development