[ https://issues.apache.org/jira/browse/CALCITE-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17953940#comment-17953940 ]
Sergey Nuyanzin edited comment on CALCITE-7041 at 5/25/25 6:44 PM: ------------------------------------------------------------------- This seems {code:sql} a > b AND b > a AND a IS NOT NULL AND b IS NOT NULL {code} in {{RexSimplify}} we should have {{terms}} like {{>($0, $1)}} and {{>($1, $0)}} I was thinking about filtering operators only for comparing operators first then partitioning terms into buckets by pair of participating inputs without caring about order. After that go through buckets and within each bucket invert some of the terms in order to have same order, after that based on comparing operators could answer whether it could be simplified to {{FALSE}} or not. It doesn't look like O(n!), or did I miss something? was (Author: sergey nuyanzin): This seems {code:sql} a > b AND b > a AND a IS NOT NULL AND b IS NOT NULL {code} in {{RexSimplify}} we should have {{terms}} like {{>($0, $1)}} and {{>($1, $0)}} I was thinking about filtering operators only for comparing operators first then partitioning terms into buckets by pair of participating inputs without caring about order. After that go through buckets and within each bucket invert some of the terms in order to have same order, after that based on comparing operators could answer whether it could be simplified to {{FALSE}} or not. It doesn't look like O(n!) > Simplify simple contradicting expressions > ----------------------------------------- > > Key: CALCITE-7041 > URL: https://issues.apache.org/jira/browse/CALCITE-7041 > Project: Calcite > Issue Type: Improvement > Reporter: Sergey Nuyanzin > Priority: Major > > For instance > {code:sql} > a > b AND b > a AND a IS NOT NULL AND b IS NOT NULL > {code} > or > {code:sql} > a >= b AND b > a AND a IS NOT NULL AND b IS NOT NULL > {code} > or > {code:sql} > a > b AND b >= a AND a IS NOT NULL AND b IS NOT NULL > {code} > could be simplified to {{FALSE}} > and > {code:sql} > a >= b AND b >= a AND a IS NOT NULL AND b IS NOT NULL > {code} > could be simplified to {{a = b}} > Probably there is something else -- This message was sent by Atlassian Jira (v8.20.10#820010)