One of the columns you are selecting is a list or map or other kind of 
collection. You can’t do that with an IN clause against a clustering column. 
Either don’t select the collection column OR don’t use the IN clause. Cassandra 
is trying to protect itself (and you) from a query that won’t scale well. Honor 
that.

As a good practice, you shouldn’t do select * (as a production query) against 
any database. You want to list the columns you actually want to select. That 
way a later “alter table add column” (or similar) doesn’t cause unpredictable 
results to the application.


Sean Durity
From: onmstester onmstester <onmstes...@zoho.com>
Sent: Sunday, May 20, 2018 10:13 AM
To: user <user@cassandra.apache.org>
Subject: [EXTERNAL] IN clause of prepared statement

The table is  something like

Samples
...
partition key (partition,resource,(timestamp,metric_name)

creating prepared statement :
session.prepare("select * from samples where partition=:partition and 
resource=:resource and timestamp>=:start and timestamp<=:end and metric_name in 
:metric_names")

failed with  exception:

can not restrict clustering columns by IN relations when a collection is 
selected by the query

The query is OK using cqlsh. using column names in select did not help.
Is there anyway to achieve this in Cassandra? I'm aware of performance problems 
of this query but it does not matter in my case!

I'm using datastax driver 3.2 and Apache cassandra 3.11.2

Sent using Zoho 
Mail<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.zoho.com_mail_&d=DwMFaQ&c=MtgQEAMQGqekjTjiAhkudQ&r=aC_gxC6z_4f9GLlbWiKzHm1vucZTtVYWDDvyLkh8IaQ&m=d__ZMBix8GTTYb6cJAHOCWr0egd468yEQKdw9VqC6Og&s=Sj7pVb3G-34G8AubnxrP5XojSKm5-gyn-DGiWLq-TK8&e=>



________________________________

The information in this Internet Email is confidential and may be legally 
privileged. It is intended solely for the addressee. Access to this Email by 
anyone else is unauthorized. If you are not the intended recipient, any 
disclosure, copying, distribution or any action taken or omitted to be taken in 
reliance on it, is prohibited and may be unlawful. When addressed to our 
clients any opinions or advice contained in this Email are subject to the terms 
and conditions expressed in any applicable governing The Home Depot terms of 
business or client engagement letter. The Home Depot disclaims all 
responsibility and liability for the accuracy and content of this attachment 
and for any damages or losses arising from any inaccuracies, errors, viruses, 
e.g., worms, trojan horses, etc., or other items of a destructive nature, which 
may be contained in this attachment and shall not be liable for direct, 
indirect, consequential or special damages in connection with this e-mail 
message or its attachment.

Reply via email to