[
https://issues.apache.org/jira/browse/CALCITE-2421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16549907#comment-16549907
]
Julian Hyde commented on CALCITE-2421:
--------------------------------------
If it simplifies "A=A and B=B" to "A is not null and B is not null" that is
worse than "foregoing a simplification" - that is an incorrect simplification.
Is this related to CALCITE-2326, where unknownAsFalse should not be a field in
RexSimplify but should be a parameter that will change when we, say, see a NOT
and make recursive calls to simplify? I think that issue is very important. We
should fix the whole thing, not nibble around the edges.
> RexSimplify#simplifyAnds foregoes some simplications if unknownAsFalse set to
> true
> ----------------------------------------------------------------------------------
>
> Key: CALCITE-2421
> URL: https://issues.apache.org/jira/browse/CALCITE-2421
> Project: Calcite
> Issue Type: Bug
> Reporter: Laurent Goujon
> Assignee: Julian Hyde
> Priority: Minor
>
> It looks like {{RexSimplify#simplifyAnds}} foregoes some comparison
> simplifications if {{unknownAsFalse}} is set to true, like {{A = A AND B =
> B}} which might be simplified to {{A IS NOT NULL AND B IS NOT NULL}} or even
> {{true}} if {{A}} and {{B}} are known to be not nullable.
> One consequence of this is that the selectivity value might be off as a {{=}}
> comparison has a selectivity of 15% whereas {{ IS NOT NULL }} has a
> selectivity of 90%.
> The simplication is skipped because {{RexSimplify#simplifyList}} simplify all
> terms with {{unknownAsFalse}} set to {{false}}, but in
> {{RexSimplify#simplifyAnd2ForUnknownAsFalse}}, there's no attempt at trying
> again to simplify each term.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)