Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2428

Incorrect result with limit if offset is negative

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: COMP - Compiler
    • Labels:
      None

      Description

      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.

       

        Attachments

          Activity

            People

            • Assignee:
              dlychagin-cb Dmitry Lychagin
              Reporter:
              dlychagin-cb Dmitry Lychagin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: