Hive
  1. Hive
  2. HIVE-1237

select coalesce(null) from src dies

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 0.7.0, 0.8.0
    • Fix Version/s: None
    • Component/s: Query Processor
    • Labels:
      None

      Description

      select coalesce(null) from src ;

      FAILED: Unknown exception: null

      1. hive-1237.patch
        3 kB
        Ashutosh Chauhan
      2. hive-1237_1.patch
        2 kB
        Ashutosh Chauhan

        Activity

        Ashutosh Chauhan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Duplicate [ 3 ]
        Hide
        Ashutosh Chauhan added a comment -

        This is getting worked upon at HIVE-2726 through an alternative approach.

        Show
        Ashutosh Chauhan added a comment - This is getting worked upon at HIVE-2726 through an alternative approach.
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Namit Jain added a comment -

        Actually, coalesce returns first non-null argument.
        With your patch, coalesce('x') will error out, which is not correct

        Show
        Namit Jain added a comment - Actually, coalesce returns first non-null argument. With your patch, coalesce('x') will error out, which is not correct
        Hide
        Namit Jain added a comment -

        +1

        running tests

        Show
        Namit Jain added a comment - +1 running tests
        Ashutosh Chauhan made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Ashutosh Chauhan added a comment -

        Marking Patch Available.

        Show
        Ashutosh Chauhan added a comment - Marking Patch Available.
        Hide
        Ashutosh Chauhan added a comment -

        @Namit,
        Any comment on this one?

        Show
        Ashutosh Chauhan added a comment - @Namit, Any comment on this one?
        Hide
        Ashutosh Chauhan added a comment -

        But, if you only have non-null arguments

        should be read as But, if you only have all-null argument

        Show
        Ashutosh Chauhan added a comment - But, if you only have non-null arguments should be read as But, if you only have all-null argument
        Hide
        Ashutosh Chauhan added a comment -

        Correct, this still fails for this query. But, if you only have non-null arguments it will fail for any udf not just coalesce. Fixing that requires work in GenericUDFUtils which is used by many functions and thus will be a bigger change and requires more testing. So, I suggest we go ahead with this and open up another ticket which will address the problem of all null arguments for udf.

        Show
        Ashutosh Chauhan added a comment - Correct, this still fails for this query. But, if you only have non-null arguments it will fail for any udf not just coalesce. Fixing that requires work in GenericUDFUtils which is used by many functions and thus will be a bigger change and requires more testing. So, I suggest we go ahead with this and open up another ticket which will address the problem of all null arguments for udf.
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Namit Jain added a comment -

        But, will this work?
        I mean, what happens to:

        select coalesce(null, null) from src;

        Show
        Namit Jain added a comment - But, will this work? I mean, what happens to: select coalesce(null, null) from src;
        Ashutosh Chauhan made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.7.0 [ 12315150 ]
        Affects Version/s 0.8.0 [ 12316178 ]
        Ashutosh Chauhan made changes -
        Attachment hive-1237_1.patch [ 12500261 ]
        Hide
        Ashutosh Chauhan added a comment -

        I think for coalesce it makes sense to have atleast two arguments. It returns first non-null of its argument. If there is zero argument there is nothing to return and if there is one argument it has to return that whether its null or not. I updated the patch to throw exception if there are less then two arguments.

        Show
        Ashutosh Chauhan added a comment - I think for coalesce it makes sense to have atleast two arguments. It returns first non-null of its argument. If there is zero argument there is nothing to return and if there is one argument it has to return that whether its null or not. I updated the patch to throw exception if there are less then two arguments.
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Namit Jain added a comment -

        A lot of tests are failing.

        TestContribCliDriver
        TestCliDriver etc.

        Please fix them and then resubmit the patch

        Show
        Namit Jain added a comment - A lot of tests are failing. TestContribCliDriver TestCliDriver etc. Please fix them and then resubmit the patch
        Hide
        Namit Jain added a comment -

        +1

        Show
        Namit Jain added a comment - +1
        Ashutosh Chauhan made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Assignee Ashutosh Chauhan [ ashutoshc ]
        Hide
        Ashutosh Chauhan added a comment -

        Making Patch Available as ready for review.

        Show
        Ashutosh Chauhan added a comment - Making Patch Available as ready for review.
        Ashutosh Chauhan made changes -
        Attachment hive-1237.patch [ 12499228 ]
        Hide
        Ashutosh Chauhan added a comment -

        returnObjectInspector should always be created, otherwise will throw NPE as demonstrated here. Patch which does that. Also, included a test case which fails without patch but passes with the patch.

        Show
        Ashutosh Chauhan added a comment - returnObjectInspector should always be created, otherwise will throw NPE as demonstrated here. Patch which does that. Also, included a test case which fails without patch but passes with the patch.
        John Sichi made changes -
        Field Original Value New Value
        Fix Version/s 0.6.0 [ 12314524 ]
        Namit Jain created issue -

          People

          • Assignee:
            Ashutosh Chauhan
            Reporter:
            Namit Jain
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development