cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua McKenzie (JIRA)" <>
Subject [jira] [Updated] (CASSANDRA-13878) Provide error message for invalid token() parameters
Date Tue, 14 Nov 2017 14:52:01 GMT


Joshua McKenzie updated CASSANDRA-13878:
    Component/s: Tools

> Provide error message for invalid token() parameters
> ----------------------------------------------------
>                 Key: CASSANDRA-13878
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL, Tools
>            Reporter: Alex Denisov
>            Priority: Minor
> Currently, there are few issues with the token() function validation.
> First one:
> It is possible to call the function with a wrong number of arguments, which could lead
to a Null Pointer Exception.
> Here is an example:
> {code}
> > CREATE TABLE test(k1 text, k2 text, PRIMARY KEY((k1, k2)));
> > INSERT INTO test(k1, k2) VALUES('foo', 'bar');
> > SELECT token(k1) FROM test;
> ServerError: java.lang.NullPointerException
> {code}
> The fix is trivial, here is an example:
> However, it uncovers the second issue.
> The token function can be called either without parameters or with N parameters (where
N = # of partition keys). The patch would not allow this to happen.
> The same goes for a function call validation as a part of where clause:
> {code}
> > SELECT * FROM test where token(k1, k2) > token();
> InvalidRequest: Error from server: code=2200 [Invalid query] message="Incorrect number
of arguments specified for function system.token : (text, text) -> bigint (expected 2,
found 0)"
> {code}
> I do not see any obvious solution here. Since the token() function is special I could
only suggest extending the `Function` class with an additional method (e.g. isTokenFunction()),
and validate the number of passed parameters accordingly.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message