mechatroner / RBQL

🦜RBQL - Rainbow Query Language: SQL-like query engine for (not only) CSV file processing. Supports SQL queries with Python and JavaScript expressions.
https://rbql.org
MIT License
281 stars 13 forks source link

Support locale-aware ORDER BY #50

Open agladysh opened 1 month ago

agladysh commented 1 month ago

Is there a way to get a locale-correct row order with RBQL?

çilek
erik
şeftali
armut
üzüm

RBQL:

SELECT a1 ORDER BY a1 ASC

Expected (correct for the tr locale):

armut
çilek
erik
şeftali
üzüm

Actual:

armut
erik
çilek
üzüm
şeftali

Judging from the source, RBQL does simple comparison of values when sorting.

In case of JS, in locale-aware sort RBQL would call String.localeCompare() on a values with a provided locale (and, potentially, options), instead of using the < operator.

This should probably be optional behavior, as (1) locale is query-specific and complicated, and (2) it would incur a performance penalty.