You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2018/07/19 22:49:00 UTC

[jira] [Comment Edited] (CALCITE-2421) RexSimplify#simplifyAnds foregoes some simplications if unknownAsFalse set to true

    [ https://issues.apache.org/jira/browse/CALCITE-2421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16549967#comment-16549967 ] 

Jesus Camacho Rodriguez edited comment on CALCITE-2421 at 7/19/18 10:48 PM:
----------------------------------------------------------------------------

I believe moving the {{unknownAsFalse}} property to be a parameter passed down through the methods, as it was before, would help us to clean this code quite a bit while maximizing simplification. (We could also do a bigger refactoring as we tackle CALCITE-2326, but just trying to propose a simpler fix). FWIW, I took a quick look and it seems to me that it does not make sense to use {{false}} in every call that is made to {{simplifyList}} either, we may be missing some simplification opportunities. 



was (Author: jcamachorodriguez):
I believe moving the {{unknownAsFalse}} property to be a parameter passed down through the methods, as it was before, would help us to clean this code quite a bit while maximizing simplification. (We could also do a bigger refactoring as we tackle CALCITE-2326, but just trying to propose a simpler fix). FWIW, I took a quick look and it seems to me that it does not make sense to use {{false}} in every call that is made to {{simplifyList}}, we may be missing some simplification opportunities. 


> 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: Laurent Goujon
>            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)