You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/10/22 21:33:00 UTC

[jira] [Created] (IMPALA-7740) Incorrect doc description for nvl2()

Paul Rogers created IMPALA-7740:
-----------------------------------

             Summary: Incorrect doc description for nvl2()
                 Key: IMPALA-7740
                 URL: https://issues.apache.org/jira/browse/IMPALA-7740
             Project: IMPALA
          Issue Type: Bug
          Components: Docs
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers


Impala offers the NVL2() function from [Oracle|https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2049.htm#OLADM625]. A clearer definition is [here|https://www.techonthenet.com/oracle/functions/nvl2.php]:

{quote}
The syntax for the NVL2 function in Oracle/PLSQL is:

{{NVL2( string1, value_if_not_null, value_if_null )}}
{quote}

Contrast that with the [Impala description|https://impala.apache.org/docs/build3x/html/topics/impala_conditional_functions.html]:

{quote}
Enhanced variant of the nvl() function. Tests an expression and returns different result values depending on whether it is NULL or not. _If the first argument is NULL, returns the second argument. If the first argument is not NULL, returns the third argument._ Equivalent to the nvl2() function from Oracle Database.
{quote}

(Emphasis added.) The description is exactly backward. To see this:

{noformat}
select n, nvl2(n, 10, 20) from ints;
+------+---------------------------+
| n    | if(n is not null, 10, 20) |
+------+---------------------------+
| NULL | 20                        |
| 0    | 10                        |
+------+---------------------------+
{noformat}

Hence, the implementation follows Oracle, the documentation is wrong.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org