-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for mixing token, multi- and single-column restrictions #4244
Comments
Refs #3574 |
@psarna - with regards to this one:
I think you are missing ALLOW FILTERING - right ? |
Are we able to support queries like
|
For the record, Cassandra supports mixing single- and multi-column relations. Cassandra: cqlsh:ks> DESCRIBE TABLE tbl ;
CREATE TABLE ks.tbl (
p1 int,
p2 int,
c1 int,
c2 int,
t text,
PRIMARY KEY ((p1, p2), c1, c2)
) WITH CLUSTERING ORDER BY (c1 ASC, c2 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.1
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';
cqlsh:ks> SELECT * FROM tbl WHERE (c1,c2) > (0,1) and c1<10 ALLOW FILTERING;
p1 | p2 | c1 | c2 | t
----+----+----+----+---
(0 rows) Scylla: cqlsh:ks> SELECT * FROM tbl WHERE (c1,c2) > (0,1) and c1<10 ALLOW FILTERING;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Mixing single column relations and multi column relations on clustering columns is not allowed" |
For multi-column restrictions, there are two failure modes:
|
We imported this error message in 792f606, Dec 2014. Cassandra subsequently gained support for mixing single and multiple column constraints in apache/cassandra@90a012a (2.0.13/2.1.5) . Although that itself is marked as fixing a regression. So we're compatible with some version of Cassandra, not randomly losing a feature. |
…index_test In this patch, we port validation/entities/secondary_index_test.java, resulting in 41 tests for various aspects of secondary indexes. Some of the original Java tests required direct access to the Cassandra internals not available through CQL, so those tests were omitted. In porting these tests, I uncovered 9 previously-unknown bugs in Scylla: Refs #8600: IndexInfo system table lists MV name instead of index name Refs #8627: Cleanly reject updates with indexed values where value > 64k Refs #8708: Secondary index is missing partitions with only a static row Refs #8711: Finding or filtering with an empty string with a secondary index seems to be broken Refs #8714: Improve error message on unsupported restriction on partition key Refs #8717: Recent fix accidentally broke CREATE INDEX IF NOT EXISTS Refs #8724: Wrong error message when attempting index of UDT column with a duration Refs #8744: Index-creation error message wrongly refers to "map" - it can be any collection Refs #8745: Secondary index CREATE INDEX syntax is missing the "values" option These tests also provide additional reproducers for already known issues: Refs #2203: Add support for SASI Refs #2962: Collection column indexing Refs #2963: Static column indexing Refs #4244: Add support for mixing token, multi- and single-column restrictions Due to these bugs, 15 out of the 41 tests here currently xfail. We actually had more failing tests, but we fixed a few of the above issues before this patch went in, so their tests are passing at the time of this submission. All 41 tests pass when running against Cassandra. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20210531112354.970028-1-nyh@scylladb.com>
A user reported that Apache Beam CassandraIO divides queries into sub-queries split into token ranges, which results in queries including both normal restrictions and token restrictions - which breaks on Scylla but works on Cassandra since 2015, as @avikivity noted above. |
At this point, the Cassandra feature is 6 years old and exists on Cassandra 2, 3 and 4 - so users with existing applications or Cassandra-oriented tools which need it will not be content knowing that Cassandra also didn't have this feature once. |
Ongoing work on #3815 will naturally fix this issue. |
Two more translated Cassandra test exposes this issue (the multi/single case) -
Both have the same command:
In this case one of the restrictions only looks like a multi-column restriction but it isn't really, which makes this error even more silly. |
This is a translation of Cassandra's CQL unit test source file validation/operations/CompactStorageTest.java into our cql-pytest framework. This very large test file includes 86 tests for various types of operations and corner cases of WITH COMPACT STORAGE tables. All 86 tests pass on Cassandra (except one using a deprecated feature that needs to be specially enabled). 30 of the tests fail on Scylla reproducing 7 already-known Scylla issues and 7 previously-unknown issues: Already known issues: Refs scylladb#3882: Support "ALTER TABLE DROP COMPACT STORAGE" Refs scylladb#4244: Add support for mixing token, multi- and single-column restrictions Refs scylladb#5361: LIMIT doesn't work when using GROUP BY Refs scylladb#5362: LIMIT is not doing it right when using GROUP BY Refs scylladb#5363: PER PARTITION LIMIT doesn't work right when using GROUP BY Refs scylladb#7735: CQL parser missing support for Cassandra 3.10's new "+=" syntax Refs scylladb#8627: Cleanly reject updates with indexed values where value > 64k New issues: Refs scylladb#12471: Range deletions on COMPACT STORAGE is not supported Refs scylladb#12474: DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs scylladb#12477: Combination of COUNT with GROUP BY is different from Cassandra in case of no matches Refs scylladb#12479: SELECT DISTINCT should refuse GROUP BY with clustering column Refs scylladb#12526: Support filtering on COMPACT tables Refs scylladb#12749: Unsupported empty clustering key in COMPACT table Refs scylladb#12815: Hidden column "value" in compact table isn't completely hidden Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This is a translation of Cassandra's CQL unit test source file validation/operations/CompactStorageTest.java into our cql-pytest framework. This very large test file includes 86 tests for various types of operations and corner cases of WITH COMPACT STORAGE tables. All 86 tests pass on Cassandra (except one using a deprecated feature that needs to be specially enabled). 30 of the tests fail on Scylla reproducing 7 already-known Scylla issues and 7 previously-unknown issues: Already known issues: Refs #3882: Support "ALTER TABLE DROP COMPACT STORAGE" Refs #4244: Add support for mixing token, multi- and single-column restrictions Refs #5361: LIMIT doesn't work when using GROUP BY Refs #5362: LIMIT is not doing it right when using GROUP BY Refs #5363: PER PARTITION LIMIT doesn't work right when using GROUP BY Refs #7735: CQL parser missing support for Cassandra 3.10's new "+=" syntax Refs #8627: Cleanly reject updates with indexed values where value > 64k New issues: Refs #12471: Range deletions on COMPACT STORAGE is not supported Refs #12474: DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs #12477: Combination of COUNT with GROUP BY is different from Cassandra in case of no matches Refs #12479: SELECT DISTINCT should refuse GROUP BY with clustering column Refs #12526: Support filtering on COMPACT tables Refs #12749: Unsupported empty clustering key in COMPACT table Refs #12815: Hidden column "value" in compact table isn't completely hidden Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #12816
This is a translation of Cassandra's CQL unit test source file validation/operations/CompactStorageTest.java into our cql-pytest framework. This very large test file includes 86 tests for various types of operations and corner cases of WITH COMPACT STORAGE tables. All 86 tests pass on Cassandra (except one using a deprecated feature that needs to be specially enabled). 30 of the tests fail on Scylla reproducing 7 already-known Scylla issues and 7 previously-unknown issues: Already known issues: Refs #3882: Support "ALTER TABLE DROP COMPACT STORAGE" Refs #4244: Add support for mixing token, multi- and single-column restrictions Refs #5361: LIMIT doesn't work when using GROUP BY Refs #5362: LIMIT is not doing it right when using GROUP BY Refs #5363: PER PARTITION LIMIT doesn't work right when using GROUP BY Refs #7735: CQL parser missing support for Cassandra 3.10's new "+=" syntax Refs #8627: Cleanly reject updates with indexed values where value > 64k New issues: Refs #12471: Range deletions on COMPACT STORAGE is not supported Refs #12474: DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs #12477: Combination of COUNT with GROUP BY is different from Cassandra in case of no matches Refs #12479: SELECT DISTINCT should refuse GROUP BY with clustering column Refs #12526: Support filtering on COMPACT tables Refs #12749: Unsupported empty clustering key in COMPACT table Refs #12815: Hidden column "value" in compact table isn't completely hidden Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #12816
This is a translation of Cassandra's CQL unit test source file validation/operations/SelectMultiColumnRelationTest.java into our cql-pytest framework. The tests reproduce four already-known Scylla bugs and three new bugs. All tests pass on Cassandra. Because of these bugs 9 of the 22 tests are marked xfail, and one is marked skip (it crashes Scylla). Already known issues: Refs scylladb#64: CQL Multi column restrictions are allowed only on a clustering key prefix Refs scylladb#4178: Not covered corner case for key prefix optimization in filtering Refs scylladb#4244: Add support for mixing token, multi- and single-column restrictions Refs scylladb#8627: Cleanly reject updates with indexed values where value > 64k New issue discovered by these tests: Refs scylladb#13217: Internal server error when null is used in multi-column relation Refs scylladb#13241: Multi-column IN restriction with tuples of different lengths crashes Scylla Refs scylladb#13250: One-element multi-column restriction should be handled like a single-column restriction Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This is a translation of Cassandra's CQL unit test source file validation/operations/SelectMultiColumnRelationTest.java into our cql-pytest framework. The tests reproduce four already-known Scylla bugs and three new bugs. All tests pass on Cassandra. Because of these bugs 9 of the 22 tests are marked xfail, and one is marked skip (it crashes Scylla). Already known issues: Refs #64: CQL Multi column restrictions are allowed only on a clustering key prefix Refs #4178: Not covered corner case for key prefix optimization in filtering Refs #4244: Add support for mixing token, multi- and single-column restrictions Refs #8627: Cleanly reject updates with indexed values where value > 64k New issue discovered by these tests: Refs #13217: Internal server error when null is used in multi-column relation Refs #13241: Multi-column IN restriction with tuples of different lengths crashes Scylla Refs #13250: One-element multi-column restriction should be handled like a single-column restriction Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #13265
This is a translation of Cassandra's CQL unit test source file validation/operations/DeleteText.java into our cql-pytest framework. There are 51 tests, and they did not reproduce any previously-unknown bug, but did provide additional reproducers for three known issues: Refs scylladb#4244 Add support for mixing token, multi- and single-column restrictions Refs scylladb#12474 DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs scylladb#13250 one-element multi-column restriction should be handled like a single-column restriction Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This is a translation of Cassandra's CQL unit test source file validation/operations/DeleteTest.java into our cql-pytest framework. There are 51 tests, and they did not reproduce any previously-unknown bug, but did provide additional reproducers for three known issues: Refs scylladb#4244 Add support for mixing token, multi- and single-column restrictions Refs scylladb#12474 DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs scylladb#13250 one-element multi-column restriction should be handled like a single-column restriction Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This is a translation of Cassandra's CQL unit test source file validation/operations/DeleteTest.java into our cql-pytest framework. There are 51 tests, and they did not reproduce any previously-unknown bug, but did provide additional reproducers for three known issues: Refs #4244 Add support for mixing token, multi- and single-column restrictions Refs #12474 DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs #13250 one-element multi-column restriction should be handled like a single-column restriction Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #13436
This is a translation of Cassandra's CQL unit test source file validation/operations/CompactStorageTest.java into our cql-pytest framework. This very large test file includes 86 tests for various types of operations and corner cases of WITH COMPACT STORAGE tables. All 86 tests pass on Cassandra (except one using a deprecated feature that needs to be specially enabled). 30 of the tests fail on Scylla reproducing 7 already-known Scylla issues and 7 previously-unknown issues: Already known issues: Refs #3882: Support "ALTER TABLE DROP COMPACT STORAGE" Refs #4244: Add support for mixing token, multi- and single-column restrictions Refs #5361: LIMIT doesn't work when using GROUP BY Refs #5362: LIMIT is not doing it right when using GROUP BY Refs #5363: PER PARTITION LIMIT doesn't work right when using GROUP BY Refs #7735: CQL parser missing support for Cassandra 3.10's new "+=" syntax Refs #8627: Cleanly reject updates with indexed values where value > 64k New issues: Refs #12471: Range deletions on COMPACT STORAGE is not supported Refs #12474: DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs #12477: Combination of COUNT with GROUP BY is different from Cassandra in case of no matches Refs #12479: SELECT DISTINCT should refuse GROUP BY with clustering column Refs #12526: Support filtering on COMPACT tables Refs #12749: Unsupported empty clustering key in COMPACT table Refs #12815: Hidden column "value" in compact table isn't completely hidden Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #12816 (cherry picked from commit 328cdb2)
This is a translation of Cassandra's CQL unit test source file validation/operations/CompactStorageTest.java into our cql-pytest framework. This very large test file includes 86 tests for various types of operations and corner cases of WITH COMPACT STORAGE tables. All 86 tests pass on Cassandra (except one using a deprecated feature that needs to be specially enabled). 30 of the tests fail on Scylla reproducing 7 already-known Scylla issues and 7 previously-unknown issues: Already known issues: Refs #3882: Support "ALTER TABLE DROP COMPACT STORAGE" Refs #4244: Add support for mixing token, multi- and single-column restrictions Refs #5361: LIMIT doesn't work when using GROUP BY Refs #5362: LIMIT is not doing it right when using GROUP BY Refs #5363: PER PARTITION LIMIT doesn't work right when using GROUP BY Refs #7735: CQL parser missing support for Cassandra 3.10's new "+=" syntax Refs #8627: Cleanly reject updates with indexed values where value > 64k New issues: Refs #12471: Range deletions on COMPACT STORAGE is not supported Refs #12474: DELETE prints misleading error message suggesting ALLOW FILTERING would work Refs #12477: Combination of COUNT with GROUP BY is different from Cassandra in case of no matches Refs #12479: SELECT DISTINCT should refuse GROUP BY with clustering column Refs #12526: Support filtering on COMPACT tables Refs #12749: Unsupported empty clustering key in COMPACT table Refs #12815: Hidden column "value" in compact table isn't completely hidden Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #12816 (cherry picked from commit 328cdb2) (cherry picked from commit e11561e) Modified for 5.1 to comment out error-path tests for "unset" values what are silently ignored (instead of being detected) in this version.
The issue is still valid (5.4 OSS):
Queuing for Q3'24, but with low priority. |
The error message you saw is really weird, and even worse than the situation before :-( |
@nyh that message doesn't seem weird at all. Look at how the code above created the table -- |
You are right @dekimir (long time no see :D). Those are regular columns. |
Thanks, correcting (the issue still present):
|
@ptrsmrn please take a look at the cql-pytest tests mentioned above and learn how to run them quickly with test/cql-pytest/run - and then you won't need to invent new and incorrect way to reproduce such issues that already have reproducers :-) |
Summary of cql-pytest tests that reproduce this issue. You can also grep the issue number (
These different tests exercises different subcases and variants of the same issue, so it's worth to check that we solve them all. |
This is Scylla's bug tracker, to be used for reporting bugs only.
If you have a question about Scylla, and not a bug, please ask it in
our mailing-list at scylladb-dev@googlegroups.com or in our slack channel.
Installation details
Scylla version (or git commit hash): master (e37e095)
Currently it's not possible to restrict columns by multi-column restrictions, token restrictions and single-column ones at the same time. We should allow that in order to make it possible to execute queries like:
The text was updated successfully, but these errors were encountered: