[
https://issues.apache.org/jira/browse/CALCITE-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17246269#comment-17246269
]
Jiatao Tao commented on CALCITE-2823:
-------------------------------------
Hi [~julianhyde] [~zabetak], this problem comes again and again, and I thinks
there's maybe no best definition, we just define ourselves.
My proposal is that:
The most valuable thing about Calcite, I think its SQL layer, so we should
mainly focus on this part.
If we select the func multiple times and the result is different, we can call
the func is non-deterministic, e.g.:
{code:java}
select func as r1, func as r2{code}
If r1 and r2 are equal, the func is deterministic, if they are not equal, it's
non-deterministic, like "RAND()"
I think this def is simple and executable, most importantly, this eliminates
the ambiguity when optimizing.
> 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)