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

Julian Hyde edited comment on CALCITE-2556 at 9/13/18 5:29 PM:
---------------------------------------------------------------

{quote}{{ReduceExpressionsRule}} uses {{RexSimplify}}.
That is basically the same code.{quote}

Not true. While it is true that {{ReduceExpressionsRule}} uses {{RexSimplify}}, 
it goes further. It is able to reduce 3 + 4 to 7, and {{RexSimplify}} is not 
capable of that.

A few years ago I came up with a "cheap" expression reducer that did not use 
Janino. We backed away from that, because of the danger was that it would make 
mistakes on the corner cases. For example, does {{CAST(3.14159 AS DECIMAL(5, 
4)) > CAST(3.14159 AS DECIMAL(4, 3))}} reduce to true or false? It depends on 
the subtleties of the rules of type promotion. I don't even know the answer, 
frankly.

Using RexFuzzer gives us a false sense of security. It uses RexInterpreter, 
which is a "cheap" expression reducer.

I think we should draw the line at (3-valued) boolean expressions and 
constraints. I don't think {{RexSimplify}} should be reducing expressions 
involving integers or date-times, or expressions that use operators such as >, 
MOD, SUBSTRING or CAST.

There might be a few exceptions to this rule if they are easy and 
self-evidently correct.


was (Author: julianhyde):
{quote}{{ReduceExpressionsRule}} uses {{RexSimplify}}.
That is basically the same code.{quote}

Not true. While it is true that {{ReduceExpressionsRule}} uses {{RexSimplify}}, 
it goes further. It is able to reduce 3 + 4 to 7, and {{RexSimplify}} is not 
capable of that.

> RexSimplify: not(trueLiteral) could be simplified to false
> ----------------------------------------------------------
>
>                 Key: CALCITE-2556
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2556
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to