Stefan Miklosovic created CASSANDRA-20237:
---------------------------------------------

             Summary: Error on server side when trying to provide a TupleType 
to select on where target type is UTF8Type
                 Key: CASSANDRA-20237
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20237
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Stefan Miklosovic


I just found this by accident.

{noformat}
cassandra@cqlsh> select * from system_views.settings where name = 
('authorizer.class_name', 'role_manager_class_name');
NoHostAvailable: ('Unable to complete the operation against any hosts', {<Host: 
127.0.0.1:9042 datacenter1>: <Error from server: code=0000 [Server error] 
message="java.lang.ClassCastException: class 
org.apache.cassandra.db.marshal.UTF8Type cannot be cast to class 
org.apache.cassandra.db.marshal.TupleType 
(org.apache.cassandra.db.marshal.UTF8Type and 
org.apache.cassandra.db.marshal.TupleType are in unnamed module of loader 
'app')">})
{noformat}

Then on server side:

{noformat}
ERROR [Native-Transport-Requests-1] 2025-01-22 13:09:22,865 
QueryMessage.java:130 - Unexpected error during query
java.lang.ClassCastException: class org.apache.cassandra.db.marshal.UTF8Type 
cannot be cast to class org.apache.cassandra.db.marshal.TupleType 
(org.apache.cassandra.db.marshal.UTF8Type and 
org.apache.cassandra.db.marshal.TupleType are in unnamed module of loader 'app')
        at org.apache.cassandra.cql3.terms.Tuples.getTupleType(Tuples.java:230)
        at 
org.apache.cassandra.cql3.terms.Tuples$Literal.prepare(Tuples.java:71)
        at org.apache.cassandra.cql3.terms.Terms$Raw$3.prepare(Terms.java:365)
        at org.apache.cassandra.cql3.Relation.toRestriction(Relation.java:216)
        at 
org.apache.cassandra.cql3.restrictions.StatementRestrictions.<init>(StatementRestrictions.java:218)
        at 
org.apache.cassandra.cql3.restrictions.StatementRestrictions.<init>(StatementRestrictions.java:157)
        at 
org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepareRestrictions(SelectStatement.java:1353)
        at 
org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:1198)
        at 
org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:1187)
        at 
org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:1159)
        at 
org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:900)
        at 
org.apache.cassandra.cql3.QueryProcessor.parse(QueryProcessor.java:357)
        at 
org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116)
{noformat}

This does not seem to be a problem for other types like sets, maps or lists:

{noformat}
cassandra@cqlsh> select * from system_views.settings where name = 
{'authorizer.class_name', 'role_manager_class_name'};
InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid 
set literal for name of type text"
cassandra@cqlsh> select * from system_views.settings where name = 
['authorizer.class_name', 'role_manager_class_name'];
InvalidRequest: Error from server: code=2200 [Invalid query] 
message="Unexpected receiver type 'text'; only list and vector are expected"
cassandra@cqlsh> select * from system_views.settings where name = 
{'authorizer.class_name': 'a', 'role_manager_class_name': 'b'};
InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid 
map literal for name of type text"
{noformat}

I would expect that tuples would be treated the same way.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to