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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 4.0.0.Alpha1
    • 4.0.0.Alpha2
    • Query
    • None

      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

              rhauch Randall Hauch (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: