Cassandra,order is wrong [duplicate]

Author: gao deyang

This question already has an answer here:

I have a question about Cassandra. At present, "entities_by_time" is ok on the 18-bit uuid through column1 sorting, but there is something wrong with uuid ascending to the 19-bit sorting. Please help me.

cqlsh:minds> select * from entities_by_time where key='activity:user:990192934408163330' order by column1 desc limit 10;
 key                              | column1            | value
----------------------------------+--------------------+--------------------
 activity:user:990192934408163330 | 999979571363188746 | 999979571363188746
 activity:user:990192934408163330 | 999979567064027139 | 999979567064027139
 activity:user:990192934408163330 | 999979562764865555 | 999979562764865555
 activity:user:990192934408163330 | 999979558465703953 | 999979558465703953
 activity:user:990192934408163330 | 999979554170736649 | 999979554170736649
 activity:user:990192934408163330 | 999979549871575047 | 999979549871575047
 activity:user:990192934408163330 | 999979545576607752 | 999979545576607752
 activity:user:990192934408163330 | 999979541290029073 | 999979541290029073
 activity:user:990192934408163330 | 999979536990867461 | 999979536990867461
 activity:user:990192934408163330 | 999979532700094475 | 999979532700094475

cqlsh:minds> select * from entities_by_time where key='activity:user:990192934408163330' order by column1 asc limit 10;

 key                              | column1             | value
----------------------------------+---------------------+---------------------
 activity:user:990192934408163330 | 1000054880351555598 | 1000054880351555598
 activity:user:990192934408163330 | 1000054884671688706 | 1000054884671688706
 activity:user:990192934408163330 | 1000054888966656017 | 1000054888966656017
 activity:user:990192934408163330 | 1000054893257429005 | 1000054893257429005
 activity:user:990192934408163330 | 1000054897552396308 | 1000054897552396308
 activity:user:990192934408163330 | 1000054901843169290 | 1000054901843169290
 activity:user:990192934408163330 | 1000054906138136577 | 1000054906138136577
 activity:user:990192934408163330 | 1000054910433103883 | 1000054910433103883
 activity:user:990192934408163330 | 1000054914723876869 | 1000054914723876869
 activity:user:990192934408163330 | 1000054919010455568 | 1000054919010455568"

Found by sorting "column1". Using desc sort, "999979571363188746" is the first, Using asc sorting, "1000054880351555598" is the first. But "1000054880351555598" is bigger than "999979571363188746"

Originally Sourced from: https://stackoverflow.com/questions/57447255/cassandra-order-is-wrong