[ 
https://issues.apache.org/jira/browse/IMPALA-5580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Hecht resolved IMPALA-5580.
-------------------------------
       Resolution: Fixed
    Fix Version/s: Impala 2.10.0

commit 3a49b4c7c9c30cd654eb156c24fd5d2a2f040cba
Author: Dan Hecht <dhe...@cloudera.com>
Date:   Thu Jul 6 13:49:53 2017 -0700

    IMPALA-5580: fix Java UDFs that return NULL strings

    In commit 741421de, we accidently made it so that is_null=true
    StringVals became is_null=false with len=0. Fix that and add
    a regression test.

    Change-Id: I34d288aad66a2609484058c9a177c02200cb6a6e

> Java UDF: return null STRING incorrectly converted to empty string
> ------------------------------------------------------------------
>
>                 Key: IMPALA-5580
>                 URL: https://issues.apache.org/jira/browse/IMPALA-5580
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.8.0
>            Reporter: Lorenzo Bagni
>            Assignee: Dan Hecht
>            Priority: Blocker
>              Labels: correctness, ramp-up
>             Fix For: Impala 2.10.0
>
>
> 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:
> {code:sql}
> [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
> {code}
> On impala v2.6.0 the same UDF works correcty.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to