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

Null comparison for greatest and least operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • UDF
    • None

    Description

      In mysql comparisons if any of the entries are null, then the result is null.

      https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html and https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html.

      This can be demonstrated by the following mysql query:

      mysql> select greatest(1, null) from test;
      +-------------------+
      | greatest(1, null) |
      +-------------------+
      |              NULL |
      +-------------------+
      1 row in set (0.00 sec)
      
      mysql> select greatest(-1, null) from test;
      +--------------------+
      | greatest(-1, null) |
      +--------------------+
      |               NULL |
      +--------------------+
      1 row in set (0.00 sec)
      

      This is in contrast to Hive, where null are ignored in the comparisons.

      hive> select greatest(null, 1) from test;
      OK
      1
      

      Attachments

        1. HIVE-12082.2.patch
          45 kB
          Szehon Ho
        2. HIVE-12082.patch
          46 kB
          Szehon Ho

        Issue Links

          Activity

            People

              szehon Szehon Ho
              szehon Szehon Ho
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: