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.1.patch
        11 kB
        Zheng Shao
      2. HIVE-470.2.patch
        11 kB
        Zheng Shao
      3. HIVE-470.3.patch
        14 kB
        Zheng Shao

        Issue Links

          Activity

          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.
          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)
          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.
          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

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development