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

Laurent Goujon commented on CALCITE-2142:
-----------------------------------------

Sorry for the long delay.

First, I think there is some confusion about {{SqlRandFunction}} which is the 
operator from {{RandFunction}} which is the generator.

The fix would apply to the operator. As for the function itself, it is really 
confusing because the annotation says:
{quote}
 * Specifies that function is deterministic (i.e. returns the same output
 * given the same inputs).
{quote}

But there's comment in {{RandFunction}} saying:
{quote}
Marked deterministic so that the code generator instantiates one once per 
query, not once per row
{quote}

Looking at {{misc.iq}} as you suggested make me think that the issue is calcite 
needs the generator to be executed only once, probably because of the seed (you 
don't want to reset the seed between rows) which is why you added the 
annotation, but overall the function is non deterministic.

Or maybe it depends if there's a seed or not? like {{RAND() == RAND()) is FALSE 
(most likely) but {{RAND(1) == RAND(1)}} is TRUE (always)?

> Set rand() function as non-deterministic.
> -----------------------------------------
>
>                 Key: CALCITE-2142
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2142
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Josh Wagner
>            Priority: Minor
>
> SqlRandFunction should override isDeterministic() such that it returns false.



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

Reply via email to