[
https://issues.apache.org/jira/browse/ASTERIXDB-3585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ian Maxon updated ASTERIXDB-3585:
---------------------------------
Labels: triaged (was: )
> 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)