You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (Jira)" <ji...@apache.org> on 2020/11/09 08:58:00 UTC
[jira] [Commented] (CALCITE-4388) RexNode#isAlwaysFalse and
isAlwaysTrue should be aligned with RexSimplify#isSafeExpression
[ https://issues.apache.org/jira/browse/CALCITE-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17228429#comment-17228429 ]
Zoltan Haindrich commented on CALCITE-4388:
-------------------------------------------
[~vladimirsitnikov] thank you for pinging me; this issue reminds me of an idea I was thinking about around I've done "saferexvisitor" stuff.
We've defined a few properties for "all" the SqlKind-s in Calcite (we have Strong and Safe - but there might be others).
However - how the actual checkers for these properties are in different files from the "Kind"-s. So if someone adds a new kind it will fall into the "default" handler in these property checker implementations.
Adding a few annotations to SqlKind could enable us to decide these properties at the time the new kind is introduced - (and probably cover things better by answering basic questions one-by-one centered around the kind - and not around the question itself).
I would categorize "isAlwaysTrue" also a property.
I would like to note one more thing: isAlwaysTrue / safe expression check and all these things could become costly - because they are walking the rex tree thru the stack...one way around this could be to add something to each rexnode which could "cache" the computed properties of the node; or pass around some entity which could take care of caching stuff
> RexNode#isAlwaysFalse and isAlwaysTrue should be aligned with RexSimplify#isSafeExpression
> ------------------------------------------------------------------------------------------
>
> Key: CALCITE-4388
> URL: https://issues.apache.org/jira/browse/CALCITE-4388
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: Vladimir Sitnikov
> Priority: Major
>
> {{(1/0) IS NULL}} should not result in {{isAlwaysFalse}}.
> Currently, {{RexSimplify}} knows that 1/0 must not be simplified, however, {{isAlwaysTrue}} and {{isAlwaysFalse}} are still wrong.
> That might result in wrong data, especially when the client code calls {{isAlways...}}
> [~kgyrtkirk], I see you contributed a lot to simplification and {{SafeRexVisitor}}. Are you interested in improving {{isAlways...}}?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)