Dmitry Lychagin created ASTERIXDB-2428:
------------------------------------------

             Summary: Incorrect result with limit if offset is negative 
                 Key: ASTERIXDB-2428
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2428
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
            Reporter: Dmitry Lychagin
            Assignee: Dmitry Lychagin


The following query should return two items, but it currently returns an empty 
result:

select value paper
from DBLP1 as paper
order by dblpid
limit 2 offset -get_year(current_date());

When an offset is negative its considered to be 0.

The problem is caused by CopyLimitDownRule which simply adds offset to the 
limit when copying the limit clause. So in this particular case the newly 
created limit clause will have a negative limit which equivalent to 0, hence no 
results.

 



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

Reply via email to