[ 
https://issues.apache.org/jira/browse/CALCITE-6507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L resolved CALCITE-6507.
--------------------------------
    Resolution: Fixed

Fixed via 
[{{8659140}}|https://github.com/apache/calcite/commit/8659140dcb689f71fecbba6b081cc525c7fc2774]
 

> Random functions are incorrectly considered deterministic
> ---------------------------------------------------------
>
>                 Key: CALCITE-6507
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6507
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Ruben Q L
>            Assignee: Ruben Q L
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.38.0
>
>
> {{{}RAND{}}}, {{{}RANDOM{}}}, and {{RAND_INTEGER}} don't override the 
> {{isDeterministic}} method, so they get the default behavior, i.e. true, 
> which is incorrect.
> This can lead to undesired consequences, e.g.:
> A) {{RelMetadataQuery#getPulledUpPredicates}} can consider them as constants 
> (and place them inside {{{}RelOptPredicateList#constantMap{}}}) since 
> {{RelMdPredicates}} calls {{{}RexUtil#isConstant{}}}, which uses a 
> {{ConstantFinder}} that evaluates whether a RexCall is constant or not based 
> on the operator's isDeterministic value.
> B) As a consequence of A) {{SortRemoveConstantKeyRule}} can incorrectly 
> remove an "ORDER BY RAND()"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to