Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-5580

Java UDF: return null STRING incorrectly converted to empty string

    Details

      Description

      Hi all,
      I'm facing on wrong behaviour using Java UDF, when i declare a 'return null;' inside the code and I call the function the value returned is a blank (like '' or "") value.
      This happen when the input type is a STRING, just to be sure I've used the TestUdf:
      http://impala.io/doc/html/TestUdf_8java_source.html
      here's my tests:

      [host:21000] > select testudf(cast(null as int));
      Query: select testudf(cast(null as int))
      --------------------------------+
      | dwh.testudf(cast(null as int)) |
      +--------------------------------+
      | NULL                           |
      +--------------------------------+
      Fetched 1 row(s) in 0.12s
      [host:21000] > select testudf(cast(null as string));
      Query: select testudf(cast(null as string))
      +-----------------------------------+
      | dwh.testudf(cast(null as string)) |
      +-----------------------------------+
      |                                   |
      +-----------------------------------+
      Fetched 1 row(s) in 0.15s
      [host:21000] > select testudf(cast(null as string)) is null;
      Query: select testudf(cast(null as string)) is null
      +-------------------------------------------+
      | dwh.testudf(cast(null as string)) is null |
      +-------------------------------------------+
      | false                                     |
      +-------------------------------------------+
      Fetched 1 row(s) in 0.12s
      [host:21000] > select testudf(cast(null as int)) is null;
      Query: select testudf(cast(null as int)) is null
      +----------------------------------------+
      | dwh.testudf(cast(null as int)) is null |
      +----------------------------------------+
      | true                                   |
      +----------------------------------------+
      Fetched 1 row(s) in 0.15s
      

      On impala v2.6.0 the same UDF works correcty.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dhecht Dan Hecht
                Reporter:
                bagnil_impala_e4d7 Lorenzo Bagni
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: