You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (JIRA)" <ji...@apache.org> on 2015/01/29 09:48:34 UTC

[jira] [Commented] (CASSANDRA-7854) Unable to select partition keys directly using IN keyword (no replacement for multi row multiget in thrift)

    [ https://issues.apache.org/jira/browse/CASSANDRA-7854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14296595#comment-14296595 ] 

Benjamin Lerer commented on CASSANDRA-7854:
-------------------------------------------

[~tnine] I do not really understand your problem description. 
# You are talking about partition keys but your table as only 1 partition key: {{scopeId}} and 3 clustering keys: {{scopeType}}, {{nodeId}} and  {{nodeType}}.
# The IN values that you give in your example are all the same.

Could you clarify the problem?

> Unable to select partition keys directly using IN keyword (no replacement for multi row multiget in thrift)
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7854
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7854
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Todd Nine
>            Assignee: Benjamin Lerer
>
> We're converting some old thrift CF's to CQL.  We aren't looking to change the underlying physical structure, since this has proven effective in production.  In order to migrate, we need full select via multi equivalent.  In thrift, the format was as follows.
> (scopeId, scopeType, nodeId, nodeType){ 0x00, timestamp }
> Where we have deliberately designed only 1 column per row.  To translate this to CQL, I have defined the following table.
> {code}
> CREATE TABLE Graph_Marked_Nodes ( 
>  scopeId uuid,
>  scopeType varchar,
>  nodeId uuid,
>  nodeType varchar,
>  timestamp bigint,
>  PRIMARY KEY(scopeId, scopeType, nodeId, nodeType)
> )
> {code}
> I then try to select using the IN keyword.
> {code}
> select timestamp from Graph_Marked_Nodes WHERE (scopeId , scopeType , nodeId , nodeType)  IN ( (5a391596-3181-11e4-a87e-600308a690e2, 'organization', 5a3a2708-3181-11e4-a87e-600308a690e2 ,'test' ),(5a391596-3181-11e4-a87e-600308a690e2, 'organization', 5a3a2709-3181-11e4-a87e-600308a690e2 ,'test' ),(5a391596-3181-11e4-a87e-600308a690e2, 'organization', 5a39fff7-3181-11e4-a87e-600308a690e2 ,'test' ) )
> {code}
> Which results in the following stack trace
> {code}
> Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Multi-column relations can only be applied to clustering columns: scopeid
> 	at com.datastax.driver.core.Responses$Error.asException(Responses.java:97)
> 	at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:110)
> 	at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:235)
> 	at com.datastax.driver.core.RequestHandler.onSet(RequestHandler.java:367)
> 	at com.datastax.driver.core.Connection$Dispatcher.messageReceived(Connection.java:584)
> {code}
> This is still possible via the thrift API.  Apologies in advance if I've filed this erroneously.  I can't find any examples of this type of query anywhere.
> Note that our size grows far too large to fit in a single physical partition (row) if we use only scopeId and scopeType, so we need all 4 data elements to be part of our partition key to ensure we have the distribution we need.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)