Ruben Q L created CALCITE-6507:
----------------------------------
Summary: 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
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)