orderBy sorting issue

43 views
Skip to first unread message

Vicky

unread,
Aug 27, 2018, 5:15:42 AM8/27/18
to lovefield-users
OrderBy sorts capital letters first and then sorts small letters.

Example : A,B,C,D,a,b,c,d

Above is the order its prints, it should be A,a,B,b,C,c,D,d

dpa...@chromium.org

unread,
Sep 5, 2018, 5:20:31 PM9/5/18
to lovefield-users
The order returned by Lovefield matches the order returned by JS sort(), which uses the unicode code numbers. Pasting below from these docs

"The default sort order is according to string Unicode code points."

For example:

[
'a','b','c','d', 'A','B','C','D'].sort(); // returns ["A", "B", "C", "D", "a", "b", "c", "d"]


AFAIK, there is currently no way to customize the sorting logic used by Lovefield.

@Arthur: Is this a discrepancy between Lovefield and other SQL engines? Do you think is worth addressing?

Arthur Hsu

unread,
Sep 5, 2018, 5:30:40 PM9/5/18
to lovefield-users
SQL sorting is case sensitive. The developers are also required to do column transformation if they wish to sort differently. I don't think Lovefield is doing anything different.
Reply all
Reply to author
Forward
0 new messages