[
https://issues.apache.org/jira/browse/ASTERIXDB-3585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17944627#comment-17944627
]
ASF subversion and git services commented on ASTERIXDB-3585:
------------------------------------------------------------
Commit 7e0c63dc755f73aa9741e08991f09763a487c059 in asterixdb's branch
refs/heads/master from Ali Alsuliman
[ https://gitbox.apache.org/repos/asf?p=asterixdb.git;h=7e0c63dc75 ]
[ASTERIXDB-3585][FUN] NULLIF(V1, V2) return V1 when V1=V2 is false/null/missing
- user model changes: yes
- storage format changes: no
- interface changes: no
Details:
NULLIF(V1, V2) should return V1 when V1 = V2 evaluates to false, null, or
missing.
- if_inf(): skip MISSING arg values.
Ext-ref: MB-37298
Change-Id: I7ab2f4f5edb5c3afbcc7d1aff972b03b25b5e4ad
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19557
Reviewed-by: Ali Alsuliman <[email protected]>
Reviewed-by: Murtadha Hubail <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Ali Alsuliman <[email protected]>
> NULLIF(V1, V2) should return V1 when V1 = V2 evaluates to false or
> null/missing
> -------------------------------------------------------------------------------
>
> Key: ASTERIXDB-3585
> URL: https://issues.apache.org/jira/browse/ASTERIXDB-3585
> Project: Apache AsterixDB
> Issue Type: Bug
> Components: FUN - Functions
> Reporter: Ali Alsuliman
> Assignee: Ali Alsuliman
> Priority: Major
> Labels: triaged
>
> NULLIF(V1, V2) should return V1 when V1 = V2 evaluates to false, null, or
> missing.
> Currently, if any argument is null/missing, then null/missing is returned
> instead of V1 due to the usual handling of null/missing arguments
> (missing-in, missing-out, null-in, null-out).
> *null_if(e1, e2), missing_if(e1, e2), nan_if(e1, e2), neginf_if(e1, e2),
> posinf_if(e1, e2):*
> As per SQL, the definition of NULLIF() is as follows:
> {code:java}
> NULLIF(V1, V2):
> CASE WHEN V1=V2 THEN NULL
> ELSE V1
> END
> // in SQL, 2 is returned because 2 = null is not true:
> NULLIF(2,null) => 2
> // in N1QL, null is returned due to the usual handling of null arguments:
> NULLIF(2,null) => null {code}
> All *_if() functions will be changed accordingly to behave the same thing
> returning the first argument when comparing and one of the argument is
> null/missing. This change will only affect and change the behavior for the
> case when the second argument is null/missing.
> if_inf(e1, e2, ..., eN) should skip missing arguments like if_nan(e1, e2,
> ..., eN) and if_nan_or_inf(e1, e2, ..., eN). Currently this is the behavior:
> {code:java}
> if_nan_or_inf(missing, NaN, INF, 4, 5) => 4
> if_nan(missing, NaN, 4, 5) => 4
> if_inf(missing, INF, 4, 5) => missing {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)