[ 
https://issues.apache.org/jira/browse/CASSANDRA-20237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17916492#comment-17916492
 ] 

David Capwell commented on CASSANDRA-20237:
-------------------------------------------

[~smiklosovic] +1 from me

bq. something for a fuzzer?

I think this would be a great place to add fuzz tests, I would be glad to 
review such a patch =D. 

Generate selects that are "invalid" and make sure we only fail due to 
validation errors and nothing else... showing the validation error is "correct" 
and "meaningful" would be out of scope (thats hard...) but making sure they are 
always validation issues wouldn't be hard...

[~smiklosovic] if you want a look at how I am doing the "valid" tests take a 
look at https://github.com/apache/cassandra/pull/3785.  Once this passes review 
I plan to port this to trunk so its not stuck in cep-15-accord (it keeps 
finding bugs in C* and not Accord...)

> Error on server side when trying to provide a TupleType to select on where 
> target type is not a tuple.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-20237
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20237
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics, CQL/Syntax
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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