Im finding that my CQL3 order by statements are returning strange results, where any strings starting with uppercase letters are ordered first, and then the lowercase strings are ordered second.

Heres an example table:

CREATE TABLE tester 
(rowkey text, colname text, colvalue text, primary key (rowkey, colname)) 
WITH COMPACT STORAGE;

If I populate it with some test data and run the following query this is what I get:

Query:

SELECT * FROM tester WHERE rowkey = 'test' ORDER BY colname ASC

Results:

rowkey | colname | colvalue
-------+---------+---------
test   | ABC     | blah
test   | Abc     | blah
test   | BBC     | blah
test   | abc     | blah
test   | bbC     | blah
test   | bbc     | blah

I cant see how that would be expected behavior. Does anyone know why its ordering it like that and how to achieve a more sensible order?

有帮助吗?

解决方案

Your columns are being sorted in lexicographical order, in which upper case characters have precedence over lower case.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top