David Capwell created CASSANDRA-19889:
-----------------------------------------
Summary: Indexing a frozen collection that is the clustering key
and reversed is rejected
Key: CASSANDRA-19889
URL: https://issues.apache.org/jira/browse/CASSANDRA-19889
Project: Cassandra
Issue Type: Bug
Components: CQL/Interpreter
Reporter: David Capwell
{code}
CREATE TABLE tbl (
pk int,
ck frozen<list<int>>,
value int,
PRIMARY KEY(pk, ck)
)
WITH CLUSTERING ORDER BY (ck DESC)
{code}
If you index “ck” it will fail
{code}
CREATE INDEX ON tbl(FULL(ck));
{code}
The failure error is
{code}
Caused by: org.apache.cassandra.exceptions.InvalidRequestException: full()
indexes can only be created on frozen collections
at
org.apache.cassandra.cql3.statements.schema.AlterSchemaStatement.ire(AlterSchemaStatement.java:222)
at
org.apache.cassandra.cql3.statements.schema.CreateIndexStatement.validateIndexTarget(CreateIndexStatement.java:250)
at
org.apache.cassandra.cql3.statements.schema.CreateIndexStatement.lambda$apply$1(CreateIndexStatement.java:177)
{code}
The reason? We have a ReverseType column! We must “unwrap” the type before
this check...
Basic test
{code}
schemaChange(format("CREATE TABLE %s.tbl (\n" +
" pk int,\n" +
" ck frozen<list<int>>,\n" +
" value int,\n" +
" PRIMARY KEY(pk, ck)\n" +
")\n" +
"WITH CLUSTERING ORDER BY (ck DESC)", KEYSPACE));
schemaChange(format("CREATE INDEX ON %s.tbl(FULL(ck));", KEYSPACE));
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]