[
https://issues.apache.org/jira/browse/CALCITE-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16642323#comment-16642323
]
Julian Hyde commented on CALCITE-2451:
--------------------------------------
Yes. As of my CALCITE-2604 fix - please read the javadoc in RexUnknownAS.java -
RexUnknownAs.FALSE tells the simplifier that the expression MAY return FALSE in
situations where the value is actually UNKNOWN. If the expression can never
return UNKNOWN then it SHOULD convert the expression's type to BOOLEAN NOT
NULL, and seeing that, the caller can stop checking for UNKNOWN.
In the specific case of "x IS TRUE". If, having simplified x with
RexUnknownAs.FALSE, the result is NOT NULL, then IS TRUE is trivial, so can be
removed.
The other important point is that the simplifier does not have to convert
3-valued to 2-valued logic if it increases complexity. We don't know what
execution engine will evaluate these expressions, and how efficiently it
handles 3VL, but it seems reasonable to assume that, on average, say, a 4 node
expression in 3VL is better than a 15 node expression in 2VL.
> RexSimplify: fuse unknownAsFalse and IS TRUE handling
> -----------------------------------------------------
>
> Key: CALCITE-2451
> URL: https://issues.apache.org/jira/browse/CALCITE-2451
> Project: Calcite
> Issue Type: Sub-task
> Components: core
> Affects Versions: 1.17.0
> Reporter: Vladimir Sitnikov
> Assignee: Julian Hyde
> Priority: Major
>
> It looks like {{unknownAsFalse}} duplicates {{IS_TRUE}} handling.
> In other words, {{withUnknownAsFalse(true). simplfy(expr)}} is more or less
> comparable to {{simplify(isTrue(expr))}}
> Implementing {{IS_TRUE/IS_FALSE/...}} simplification possibilities might make
> {{unknownAsFalse}} obsolete.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)