1

I'm understand in Cassandra, especially cqlsh I can get a slice of columns. I will explain in a moment. Here is my table:

CREATE TABLE movies (
    key text PRIMARY KEY,
    boot text,
    effect text,
    foo text,
    movie text,
    starring text
);

and some contents:

key       | boot                | effect | foo  | movie         | starring
-----------+-----------------------+--------+------+---------------+----------
  starwars | Revenge of the Nerds3 |   null |  bar |     Star Wars |     null
 star trek |                  null |   null | null | into darkness |     null

Now, I'm to understand I can get a slice of these columns: like, say effect, foo and movie by the following:

select effect..movie from movies 

and I should get all of these columns. However, this is what I get when I run the query:

Bad Request: line 1:7 no viable alternative at input 'effect'

Is this what I should be doing or is there another procedure or is my thinking / information incorrect?

Part of my assumption is based on what is shown in Are CQL2 column slices and CQL3 wheres on composite keys equivalent?

4

1 回答 1

1

I think you are confusing Thrift columns with CQL3 columns.

  1. What you want to accomplish is pretty easy using a list of column names in the SELECT:

    Select all columns:

    SELECT * from movies
    

    Select only specific columns:

    SELECT effect, foo, movie from movies
    
  2. You can find the complete CQL3 spec here.

  3. You could also follow this CQL tutorial.

于 2013-09-10T05:05:29.853 回答