Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2163

Add support in JCR-SQL2 for ordering with nulls first or last

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.Alpha2
    • Fix Version/s: 4.0.0.Alpha1
    • Component/s: Query
    • Labels:
      None

      Description

      The new query engine (MODE-2018) originally always returned nulls first, even with DESC and ASC ordering. This made it difficult to verify results in unit tests, so while fixing this it was also pretty easy to add support for "NULLS FIRST" or "NULLS LAST" on each of the ordering expressions. For example:

      SELECT * FROM [car:Car] ORDER BY [car:msrp] DESC NULLS FIRST
      

      The grammar would be modified to be:

      orderings ::= Ordering {',' Ordering}
       
      Ordering ::= DynamicOperand [Order] [NullOrder]
       
      Order ::= 'ASC' | 'DESC'
      
      NullOrder ::= 'NULLS FIRST' | 'NULLS LAST'
      

      If the null ordering is not specified then the handling of the null values is:

      • NULLS LAST if the sort is ASC
      • NULLS FIRST if the sort is DESC

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rhauch Randall Hauch
                  Reporter:
                  rhauch Randall Hauch
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: