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

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

I added some suggestions to CALCITE-3760 - namely to ensure that 
non-deterministic function calls only occur at the top of an expression in a 
Project - that I think would be useful here.

For the record, I think this PR is pretty good. It could be re-worked to be 
consistent with the 'non-deterministic always on top' rule.

I'm still not sure whether non-deterministic functions can be pushed down. But 
I am inclined to believe [~godfreyhe] that they can.

> 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
>            Priority: Major
>              Labels: pull-request-available
>
> 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
(v8.3.4#803005)

Reply via email to