You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Kuldeep Mishra <ku...@gmail.com> on 2013/04/10 09:42:36 UTC
Getting NullPointerException while executing query
Hi ,
TABLE -
CREATE TABLE "CQLUSER" (
id int PRIMARY KEY,
age int,
name text
)
Query -
select * from "CQLUSER" where token(name) > token(deep);
ERROR -
Bad Request: Failed parsing statement: [select * from "CQLUSER" where
token(name) > token(deep);] reason: NullPointerException null
text could not be lexed at line 1, char 15
--
Thanks and Regards
Kuldeep Kumar Mishra
+919540965199
Re: Getting NullPointerException while executing query
Posted by Kuldeep Mishra <ku...@gmail.com>.
I am using cassandra 1.2.0,
Thanks
Kuldeep
On Wed, Apr 10, 2013 at 10:40 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
> On which version of Cassandra are you? I can't reproduce the
> NullPointerException on Cassandra 1.2.3.
>
> That being said, that query is not valid, so you will get an error
> message. There is 2 reasons why it's not valid:
> 1) in token(deep), deep is not a valid term. So you should have
> something like: token('deep').
> 2) the name column is not the partition key so the token method cannot
> be applied to it.
>
> A valid query with that schema would be for instance:
> select * from "CQLUSER" where token(id) > token(4)
> though I don't know if that help in any way for what you aimed to do.
>
> --
> Sylvain
>
>
> On Wed, Apr 10, 2013 at 9:42 AM, Kuldeep Mishra <ku...@gmail.com>wrote:
>
>> Hi ,
>> TABLE -
>> CREATE TABLE "CQLUSER" (
>> id int PRIMARY KEY,
>> age int,
>> name text
>> )
>> Query -
>> select * from "CQLUSER" where token(name) > token(deep);
>>
>> ERROR -
>> Bad Request: Failed parsing statement: [select * from "CQLUSER" where
>> token(name) > token(deep);] reason: NullPointerException null
>> text could not be lexed at line 1, char 15
>>
>> --
>> Thanks and Regards
>> Kuldeep Kumar Mishra
>> +919540965199
>>
>
>
--
Thanks and Regards
Kuldeep Kumar Mishra
+919540965199
Re: Getting NullPointerException while executing query
Posted by Sylvain Lebresne <sy...@datastax.com>.
On which version of Cassandra are you? I can't reproduce the
NullPointerException on Cassandra 1.2.3.
That being said, that query is not valid, so you will get an error message.
There is 2 reasons why it's not valid:
1) in token(deep), deep is not a valid term. So you should have something
like: token('deep').
2) the name column is not the partition key so the token method cannot be
applied to it.
A valid query with that schema would be for instance:
select * from "CQLUSER" where token(id) > token(4)
though I don't know if that help in any way for what you aimed to do.
--
Sylvain
On Wed, Apr 10, 2013 at 9:42 AM, Kuldeep Mishra <ku...@gmail.com>wrote:
> Hi ,
> TABLE -
> CREATE TABLE "CQLUSER" (
> id int PRIMARY KEY,
> age int,
> name text
> )
> Query -
> select * from "CQLUSER" where token(name) > token(deep);
>
> ERROR -
> Bad Request: Failed parsing statement: [select * from "CQLUSER" where
> token(name) > token(deep);] reason: NullPointerException null
> text could not be lexed at line 1, char 15
>
> --
> Thanks and Regards
> Kuldeep Kumar Mishra
> +919540965199
>