scylladb/python-driver

cqlengine tests are failing when scylla 5.2 and up is used [Order by currently only supports the ordering of columns following their declared order in the PRIMARY KEY]

Opened this issue · 3 comments

seems like this change shoved away those tests with the @requirescollectionindexes

and we weren't running them with scylla 5.1

but those two still fails, and need to be investigated:

  • FAILED tests/integration/cqlengine/query/test_queryset.py::TestQuerySetOrdering::test_order_by_success_case - cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Order by currently only supports the ordering of columns following their declared order in the PRIMARY KEY"
  • FAILED tests/integration/cqlengine/test_connections.py::TestQuerySetOrderingNoDefault::test_order_by_success_case - cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Order by currently only supports the ordering of columns following their declared order in the PRIMARY KEY"

the test model is:

class TestModel(Model):

    test_id = columns.Integer(primary_key=True)
    attempt_id = columns.Integer(primary_key=True)
    description = columns.Text()
    expected_result = columns.Integer()
    test_result = columns.Integer()

the schema:

CREATE TABLE cqlengine_test.test_model (
    test_id int,
    attempt_id int,
    description text,
    expected_result int,
    test_result int,
    PRIMARY KEY (test_id, attempt_id)
) WITH CLUSTERING ORDER BY (attempt_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
    AND comment = ''
    AND compaction = {'class': 'SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

and this is the query

q = TestModel.objects(test_id=0).order_by('attempt_id')
# SELECT "attempt_id", "description", "expected_result", "test_result" FROM cqlengine_test.test_model WHERE "test_id" = %(0)s ORDER BY "attempt_id" ASC LIMIT 10000

@nyh can you give me a hand understanding this one ?

is that a scylla limitation ? is there a way around it ? is this limitation documented anywhere ?