[
https://issues.apache.org/jira/browse/CALCITE-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17150229#comment-17150229
]
Ruben Q L commented on CALCITE-4099:
------------------------------------
{{NullPolicy}} is defined as:
{code}
/**
* Describes when a function/operator will return null.
*
* <p>STRICT and ANY are similar. STRICT says f(a0, a1) will NEVER return
* null if a0 and a1 are not null. This means that we can check whether f
* returns null just by checking its arguments. Use STRICT in preference to
* ANY whenever possible.</p>
*/
public enum NullPolicy {
/** Returns null if and only if one of the arguments are null. */
STRICT,
/** Returns null if one of the arguments is null, and possibly other times. */
SEMI_STRICT,
/** If any of the arguments are null, return null. */
ANY,
/** If the first argument is null, return null. */
ARG0,
/** If any of the arguments are false, result is false; else if any
* arguments are null, result is null; else true. */
AND,
/** If any of the arguments are true, result is true; else if any
* arguments are null, result is null; else false. */
OR,
/** If any argument is true, result is false; else if any argument is null,
* result is null; else true. */
NOT,
NONE
}
{code}
{{Strong.Policy}} is defined as:
{code}
/** How whether an operator's operands are null affects whether a call to
* that operator evaluates to null. */
public enum Policy {
/** This kind of expression is never null. No need to look at its arguments,
* if it has any. */
NOT_NULL,
/** This kind of expression has its own particular rules about whether it
* is null. */
CUSTOM,
/** This kind of expression is null if and only if at least one of its
* arguments is null. */
ANY,
/** This kind of expression may be null. There is no way to rewrite. */
AS_IS,
}
{code}
My understanding is that we could refactor the following values together if we
carry out the unification:
- Strong.Policy.ANY === NullPolicy.ANY / NullPolicy.STRICT
- Strong.Policy.AS_IS === NullPolicy.NONE
> Unify Strong.Policy and NullPolicy
> ----------------------------------
>
> Key: CALCITE-4099
> URL: https://issues.apache.org/jira/browse/CALCITE-4099
> Project: Calcite
> Issue Type: Task
> Components: core
> Reporter: Ruben Q L
> Priority: Minor
>
> (discussion about this ticket started in CALCITE-4094)
> {{Strong.Policy}} and {{NullPolicy}} are two different enum that represent
> grosso-modo the same thing. The former is mostly used on the simplifier, and
> the latter on the code generation.
> To be studied if we could unify both entities and make it available through
> the SqlOperator.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)