Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-15489

Solr SQL should respect OFFSET and FETCH criteria when used with ORDER BY

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.0, 8.10
    • Parallel SQL

    Description

      Tried a simple example over a collection containing 11 docs with id's (1-11)

      SELECT id FROM $ALIAS ORDER BY id DESC OFFSET 5 FETCH NEXT 5 ROWS ONLY
      

      Got back the first page (11,10,9,8,7) vs. the second (6,5,4,3,2), i.e. it's just doing LIMIT 5 with offset 0 vs. respecting the FETCH with OFFSET.

      From the Calcite grammar:

      [ ORDER BY orderItem [, orderItem ]* ]
            [ LIMIT [ start, ] { count | ALL } ]
            [ OFFSET start { ROW | ROWS } ]
            [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
      

      Attachments

        Activity

          People

            thelabdude Timothy Potter
            thelabdude Timothy Potter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 50m
                1h 50m