You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/06/02 17:29:00 UTC

[jira] [Commented] (CALCITE-2348) handling non-deterministic operator in rules

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

Julian Hyde commented on CALCITE-2348:
--------------------------------------

This is by design. If the operator is non-deterministic and you push it down (or otherwise transform the query in such a way that it receives different calls, or the same calls in a different order) then the query will give different results.

> handling non-deterministic operator in rules
> --------------------------------------------
>
>                 Key: CALCITE-2348
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2348
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: godfrey he
>            Assignee: Julian Hyde
>            Priority: Major
>
> Currently,  rules do not handle non-deterministic operator,
> e.g. FilterAggregateTransposeRule can't push down a non-deterministic filter through an aggregate.
> {code:java}
> // rand_substr is a non-deterministic udf
> @Test public void testPushFilterPastAggWithNondeterministicFilter() {
>   final String sql = "select ename, empno, c from\n"
>       + " (select ename, empno, count(*) as c from emp group by ename, empno) t\n"
>       + " where rand_substr(ename, 1, 3) = 'Tom' and empno = 10";
>   checkPlanning(FilterAggregateTransposeRule.INSTANCE, sql);
> }{code}
>  



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