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

Julian Hyde commented on CALCITE-2823:
--------------------------------------

Here's how I see the hierarchy:
 * for non-deterministic functions such as {{RAND}}, the result from two calls 
may be different, even if they are called with the same arguments, in the same 
row, in the same statement;
 * for yyyy functions such as YYY, the result is the same if you make the same 
sequence of calls, with the same arguments, to a given instance of the function;
 * for dynamic functions such as {{CURRENT_TIMESTAMP}}, the result from two 
calls may be different if called with different arguments, or in different 
statements; but within a statement, is always the same if called with the same 
arguments, even if they are called in different rows;
 * for xxxx functions such as Oracle's {{NEXTVAL}} and MySQL's {{RAND()}}, the 
result from two calls may be different if called with different arguments, or 
in different statements, or in different rows of the same statement; but within 
the same row of the same statement, is always the same if called with the same 
arguments;
 * for pure functions such as {{SUBSTRING}}, the result depends only on the 
arguments.

Not sure what xxxx and yyyy should be.

> Prevent optimization of non-deterministic functions
> ---------------------------------------------------
>
>                 Key: CALCITE-2823
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2823
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Siddharth Teotia
>            Priority: Major
>
> RexSimplify and RexProgram optimize expressions like A() = A() to true, but 
> if A() is a non-deterministic expression, this optimization is invalid. 
> Change RexSimplify and RexProgram to check if expression is deterministic or 
> not, in order to decide about the optimization.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to