Jon Haddad created CASSANDRA-19643:
--------------------------------------
Summary: IndexOutOfBoundsException thrown executing query when
bound parameters are missing
Key: CASSANDRA-19643
URL: https://issues.apache.org/jira/browse/CASSANDRA-19643
Project: Cassandra
Issue Type: Bug
Reporter: Jon Haddad
I prepared a query and tried to execute it without binding the parameters and
this exception was thrown. I think we should do a better job of telling the
user how they didn't pass enough params instead of throwing exceptions.
I prepared this query:
{noformat}
SELECT * from system.local WHERE token(key) > ? AND token(key) < ?{noformat}
Here's the exception:
{noformat}
ERROR [Native-Transport-Requests-1] 2024-05-17 13:39:51,786
ErrorMessage.java:457 - Unexpected exception during request
java.lang.IndexOutOfBoundsException: null
at java.base/java.nio.Buffer.checkIndex(Buffer.java:693)
at java.base/java.nio.HeapByteBuffer.getLong(HeapByteBuffer.java:458)
at org.apache.cassandra.utils.ByteBufferUtil.toLong(ByteBufferUtil.java:505)
at
org.apache.cassandra.dht.Murmur3Partitioner$2.fromByteArray(Murmur3Partitioner.java:376)
at
org.apache.cassandra.cql3.restrictions.StatementRestrictions.getTokenBound(StatementRestrictions.java:913)
at
org.apache.cassandra.cql3.restrictions.StatementRestrictions.getPartitionKeyBoundsForTokenRestrictions(StatementRestrictions.java:879)
at
org.apache.cassandra.cql3.restrictions.StatementRestrictions.getPartitionKeyBounds(StatementRestrictions.java:841)
at
org.apache.cassandra.cql3.statements.SelectStatement.getRangeCommand(SelectStatement.java:793)
at
org.apache.cassandra.cql3.statements.SelectStatement.getQuery(SelectStatement.java:408)
at
org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:332)
at
org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:108)
at
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:256)
at
org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:823)
at
org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:801)
at
org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:167)
at org.apache.cassandra.transport.Message$Request.execute(Message.java:256)
at
org.apache.cassandra.transport.Dispatcher.processRequest(Dispatcher.java:194)
at
org.apache.cassandra.transport.Dispatcher.processRequest(Dispatcher.java:213)
at
org.apache.cassandra.transport.Dispatcher.processRequest(Dispatcher.java:240)
at
org.apache.cassandra.transport.Dispatcher$RequestProcessor.run(Dispatcher.java:137)
at org.apache.cassandra.concurrent.FutureTask$1.call(FutureTask.java:96)
at org.apache.cassandra.concurrent.FutureTask.call(FutureTask.java:61)
at org.apache.cassandra.concurrent.FutureTask.run(FutureTask.java:71)
at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829){noformat}
Found in cassandra-5.0 branch, not sure how far back it goes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]