Hans Zeller created TRAFODION-2273:
--------------------------------------

             Summary: Predicate on "partition by" columns in sequence function 
should be pushed down
                 Key: TRAFODION-2273
                 URL: https://issues.apache.org/jira/browse/TRAFODION-2273
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-cmp
    Affects Versions: 2.0-incubating
            Reporter: Hans Zeller
            Priority: Minor


The sequence operator that implement OLAP functions like RANK() has to prevent 
certain predicates from being pushed down. Right now it is too conservative, 
though, in preventing predicates on the PARTITION BY columns from being pushed 
down, too. Here is an example:

{noformat}
create table tseq1(a int, b int);
insert into tseq1 values (1,1), (1,2), (2,1), (2,2);

explain
select *
from (select a, b, rank() over(partition by a order by b) r
      from tseq1)
where a < 2 and b = 1 and r > 1;
{noformat}

Predicate "a<2" should be pushed down to the scan of table tseq1, but it isn't. 
This is not incorrect, but also not very efficient.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to