3rd time same mistake...And it tells it all in the error message that it is
giving...

Now u r saying in createIndexedSlicesQuery(keyspace, ss, ss, ss) that ur
values are going to be String, but u r converting both values to
ByteBuffers.

As shown in
https://groups.google.com/group/hector-users/browse_thread/thread/520c5332dedfca4a,
pls pass the valueSerializer as BBS (ByteBufferSerializer)



2011/2/17 Raoyixuan (Shandy) <raoyix...@huawei.com>

>  I modify it as below
>
> StringSerializer ss = StringSerializer.get();
> IndexedSlicesQuery<String, String, String> indexedSlicesQuery =
> HFactory.createIndexedSlicesQuery(keyspace, ss, ss, ss);
> indexedSlicesQuery.setColumnNames("full_name", "birth_date", "state");
> indexedSlicesQuery.addGtExpression("birth_date",
> longSerializer.toByteBuffer (1970L));
> indexedSlicesQuery.addEqualsExpression("state",
> stringSerializer.toByteBuffer("UT"));
>
> indexedSlicesQuery.setColumnFamily("users");
> indexedSlicesQuery.setStartKey("");
> QueryResult<OrderedRows<String, String, String>> result =
> indexedSlicesQuery.execute();
>
> It shows the error
>
>
>
> The method addGtExpression(String,String) in the type
> IndexedSlicesQuery<String,String,String> is not applicable for the
> arguments(String,ByteBuffer)
>
>
>
> *From:* Roshan Dawrani [mailto:roshandawr...@gmail.com]
> *Sent:* Thursday, February 17, 2011 10:54 AM
>
> *To:* user@cassandra.apache.org
> *Subject:* Re: indexedslicesQuery class error
>
>
>
> You didn't see the previously given link?
>
>
>
> @see:
> https://groups.google.com/group/hector-users/browse_thread/thread/520c5332dedfca4a
>
> 2011/2/17 Raoyixuan (Shandy) <raoyix...@huawei.com>
>
> But my requirement is get the data by birth_date and state , how to achieve
> it  by hector client?
>
>
>
> *From:* Roshan Dawrani [mailto:roshandawr...@gmail.com]
> *Sent:* Thursday, February 17, 2011 10:48 AM
>
>
> *To:* user@cassandra.apache.org
> *Subject:* Re: indexedslicesQuery class error
>
>
>
> addGtEqual???
>
>
>
> You are still making the same mistake.
>
>
>
> You are now saying that your values are going to be long (by passing LS as
> the valueSerializer), but in *addEqualsExpression*(), you are passing a
> String value.
>
> 2011/2/17 Raoyixuan (Shandy) <raoyix...@huawei.com>
>
> Not really.
>
>
>
> I also tried the code as below:
>
> StringSerializer ss = StringSerializer.get();
>
> LongSerializer ls = LongSerializer.get();
> IndexedSlicesQuery<String, String, Long> indexedSlicesQuery =
> HFactory.createIndexedSlicesQuery(keyspace, ss, ss, ls);
>
>
> indexedSlicesQuery.setColumnNames("full_name", "birth_date", "state");
> indexedSlicesQuery.addGtExpression("birth_date", 1970L);
> indexedSlicesQuery.addEqualsExpression("state", "UT");
> indexedSlicesQuery.setColumnFamily("users");
> indexedSlicesQuery.setStartKey("");
>
> QueryResult<OrderedRows<String, String, Long>> result =
> indexedSlicesQuery.execute();
>
> It shows the error:
>
> The method addGtEqual<Epression(String,Long) in the type
> IndexedSlicesQuery<String,String,Long> is not applicable for the
> arguments(String,String)
>
>
>
>
>
>
>
> *From:* Roshan Dawrani [mailto:roshandawr...@gmail.com]
> *Sent:* Thursday, February 17, 2011 10:37 AM
> *To:* user@cassandra.apache.org
> *Subject:* Re: indexedslicesQuery class error
>
>
>
> That's because in createIndexedSlicesQuery(), you have used SS as the
> valueSerializer, and then in addGtExpression("birth_date", 1970L), you pass
> a long as the value.
>
>
>
> @see:
> https://groups.google.com/group/hector-users/browse_thread/thread/520c5332dedfca4a
>
>
>
> 2011/2/17 Raoyixuan (Shandy) <raoyix...@huawei.com>
>
>  I do the range query  by the hector client when the state and birht_date
> columns are both indexed, it show the error:
>
>
>
> The method addGtExpression(String,String) in the type
> IndexedSlicesQuery<String,String,String> is not applicable for the
> arguments(String,long)
>
>
>
> The code is as below:
>
>
>
> StringSerializer ss = StringSerializer.get();
> IndexedSlicesQuery<String, String, String> indexedSlicesQuery =
> HFactory.createIndexedSlicesQuery(keyspace, ss, ss, ss);
> indexedSlicesQuery.setColumnNames("full_name", "birth_date", "state");
> indexedSlicesQuery.addGtExpression("birth_date", 1970L);
> indexedSlicesQuery.addEqualsExpression("state", "UT");
> indexedSlicesQuery.setColumnFamily("users");
> indexedSlicesQuery.setStartKey("");
> QueryResult<OrderedRows<String, String, String>> result =
> indexedSlicesQuery.execute();
>
>
>
> 华为技术有限公司 Huawei Technologies Co., Ltd.[image: Company_logo]
>
>
>
>
>
>
>
>
> Email: raoyix...@huawei.com
> 地址:深圳市龙岗区坂田华为基地 邮编:518129
> Huawei Technologies Co., Ltd.
> Bantian, Longgang District,Shenzhen 518129, P.R.China
> http://www.huawei.com
>  ------------------------------
>
> 本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
> 止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
> 的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
> This e-mail and its attachments contain confidential information from
> HUAWEI, which
> is intended only for the person or entity whose address is listed above.
> Any use of the
> information contained herein in any way (including, but not limited to,
> total or partial
> disclosure, reproduction, or dissemination) by persons other than the
> intended
> recipient(s) is prohibited. If you receive this e-mail in error, please
> notify the sender by
> phone or email immediately and delete it!
>
>
>
>
>
>
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani <http://twitter.com/roshandawrani>
> Skype: roshandawrani
>
>
>
>
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani <http://twitter.com/roshandawrani>
> Skype: roshandawrani
>
>
>



-- 
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani <http://twitter.com/roshandawrani>
Skype: roshandawrani

<<image001.jpg>>

Reply via email to