You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by yikes bigdata <yi...@gmail.com> on 2011/06/16 17:51:41 UTC
Unable to access column family in CLI after building CF in CQL
Hi,
I was following the CQL example on the DataStax website and was able to
create a new column family and query it. But when I viewed the column family
in the CLI, it gives me the following error.
# Unable to read column family created from CQL
[default@store] list users2;
*users2 not found in current keyspace.*
Also, when I try to query the user table from CQL, i'm unable to filter on a
key. The user table was created in the CLI but accessible by CQL with a
simple select * from users;
cqlsh> select * from users where key='tyler';
*Bad Request: cannot parse 'tyler' as hex bytes*
# In the CLI, the store keyspaces displays two column families .
[default@store] show keyspaces;
Keyspace: store:
Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
Options: [replication_factor:1]
Column Families:
*ColumnFamily: users*
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator:
org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.AsciiType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 200000.0/14400
Memtable thresholds: 0.26718749999999997/57/1440 (millions of
ops/MB/minutes)
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 1.0
Replicate on write: false
Built indexes: []
Column Metadata:
Column Name: email
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: userName
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
*ColumnFamily: users2*
Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Default column value validator:
org.apache.cassandra.db.marshal.UTF8Type
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 200000.0/14400
Memtable thresholds: 0.26718749999999997/57/1440 (millions of
ops/MB/minutes)
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 1.0
Replicate on write: true
Built indexes: []
Column Metadata:
Column Name: session_token
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: state
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: password
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: birth_year
Validation Class: org.apache.cassandra.db.marshal.LongType
Column Name: gender
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Keyspace: system:
Able to see the list of keys generate within the CLI
[default@store] list users;
Using default limit of 100
-------------------
RowKey: foo
=> (column=age, value=3339, timestamp=1308182349595000)
=> (column=email, value=foo@email.com, timestamp=1308182349594000)
=> (column=userName, value=foo, timestamp=1308182349591000)
-------------------
RowKey: bar
=> (column=email, value=bar@email.com, timestamp=1308182355297000)
=> (column=gender, value=66, timestamp=1308182355299000)
=> (column=userName, value=bar, timestamp=1308182355295000)
-------------------
RowKey: tyler
=> (column=email, value=tyler@email.com, timestamp=1308182355303000)
=> (column=sports, value=6261736562616c6c, timestamp=1308182355309000)
=> (column=userName, value=tyler, timestamp=1308182355302000)
Re: Unable to access column family in CLI after building CF in CQL
Posted by Jonathan Ellis <jb...@gmail.com>.
If you create CFs outside the cli, you may need to restart it to
refresh its internal cache of the schema.
On Thu, Jun 16, 2011 at 8:51 AM, yikes bigdata <yi...@gmail.com> wrote:
> Hi,
> I was following the CQL example on the DataStax website and was able to
> create a new column family and query it. But when I viewed the column family
> in the CLI, it gives me the following error.
> # Unable to read column family created from CQL
> [default@store] list users2;
> users2 not found in current keyspace.
> Also, when I try to query the user table from CQL, i'm unable to filter on a
> key. The user table was created in the CLI but accessible by CQL with a
> simple select * from users;
> cqlsh> select * from users where key='tyler';
> Bad Request: cannot parse 'tyler' as hex bytes
>
>
>
>
> # In the CLI, the store keyspaces displays two column families .
> [default@store] show keyspaces;
> Keyspace: store:
> Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
> Options: [replication_factor:1]
> Column Families:
> ColumnFamily: users
> Key Validation Class: org.apache.cassandra.db.marshal.BytesType
> Default column value validator:
> org.apache.cassandra.db.marshal.BytesType
> Columns sorted by: org.apache.cassandra.db.marshal.AsciiType
> Row cache size / save period in seconds: 0.0/0
> Key cache size / save period in seconds: 200000.0/14400
> Memtable thresholds: 0.26718749999999997/57/1440 (millions of
> ops/MB/minutes)
> GC grace seconds: 864000
> Compaction min/max thresholds: 4/32
> Read repair chance: 1.0
> Replicate on write: false
> Built indexes: []
> Column Metadata:
> Column Name: email
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: userName
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> ColumnFamily: users2
> Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Default column value validator:
> org.apache.cassandra.db.marshal.UTF8Type
> Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
> Row cache size / save period in seconds: 0.0/0
> Key cache size / save period in seconds: 200000.0/14400
> Memtable thresholds: 0.26718749999999997/57/1440 (millions of
> ops/MB/minutes)
> GC grace seconds: 864000
> Compaction min/max thresholds: 4/32
> Read repair chance: 1.0
> Replicate on write: true
> Built indexes: []
> Column Metadata:
> Column Name: session_token
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: state
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: password
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: birth_year
> Validation Class: org.apache.cassandra.db.marshal.LongType
> Column Name: gender
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Keyspace: system:
> Able to see the list of keys generate within the CLI
> [default@store] list users;
> Using default limit of 100
> -------------------
> RowKey: foo
> => (column=age, value=3339, timestamp=1308182349595000)
> => (column=email, value=foo@email.com, timestamp=1308182349594000)
> => (column=userName, value=foo, timestamp=1308182349591000)
> -------------------
> RowKey: bar
> => (column=email, value=bar@email.com, timestamp=1308182355297000)
> => (column=gender, value=66, timestamp=1308182355299000)
> => (column=userName, value=bar, timestamp=1308182355295000)
> -------------------
> RowKey: tyler
> => (column=email, value=tyler@email.com, timestamp=1308182355303000)
> => (column=sports, value=6261736562616c6c, timestamp=1308182355309000)
> => (column=userName, value=tyler, timestamp=1308182355302000)
>
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com
Re: Unable to access column family in CLI after building CF in CQL
Posted by yikes bigdata <yi...@gmail.com>.
Ah that works.
Thanks everyone for the help.
On Thu, Jun 16, 2011 at 9:04 AM, Konstantin Naryshkin
<ko...@a-bb.net>wrote:
> The second error (the CQL select) is because you have different Key
> Validation Class values for your two user columns. users is org.apache.cassandra.db.marshal.BytesType,
> while users2 is org.apache.cassandra.db.marshal.UTF8Type. The select is
> failing because you are comparing a String to a bunch of bytes.
>
> ------------------------------
> *From: *"yikes bigdata" <yi...@gmail.com>
> *To: *user@cassandra.apache.org
> *Sent: *Thursday, June 16, 2011 3:51:41 PM
> *Subject: *Unable to access column family in CLI after building CF in CQL
>
>
> Hi,
>
> I was following the CQL example on the DataStax website and was able to
> create a new column family and query it. But when I viewed the column family
> in the CLI, it gives me the following error.
>
> # Unable to read column family created from CQL
>
> [default@store] list users2;
> *users2 not found in current keyspace.*
>
> Also, when I try to query the user table from CQL, i'm unable to filter on
> a key. The user table was created in the CLI but accessible by CQL with a
> simple select * from users;
>
> cqlsh> select * from users where key='tyler';
> *Bad Request: cannot parse 'tyler' as hex bytes*
>
>
>
>
>
> # In the CLI, the store keyspaces displays two column families .
>
> [default@store] show keyspaces;
> Keyspace: store:
> Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
> Options: [replication_factor:1]
> Column Families:
> *ColumnFamily: users*
> Key Validation Class: org.apache.cassandra.db.marshal.BytesType
> Default column value validator:
> org.apache.cassandra.db.marshal.BytesType
> Columns sorted by: org.apache.cassandra.db.marshal.AsciiType
> Row cache size / save period in seconds: 0.0/0
> Key cache size / save period in seconds: 200000.0/14400
> Memtable thresholds: 0.26718749999999997/57/1440 (millions of
> ops/MB/minutes)
> GC grace seconds: 864000
> Compaction min/max thresholds: 4/32
> Read repair chance: 1.0
> Replicate on write: false
> Built indexes: []
> Column Metadata:
> Column Name: email
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: userName
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> *ColumnFamily: users2*
> Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Default column value validator:
> org.apache.cassandra.db.marshal.UTF8Type
> Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
> Row cache size / save period in seconds: 0.0/0
> Key cache size / save period in seconds: 200000.0/14400
> Memtable thresholds: 0.26718749999999997/57/1440 (millions of
> ops/MB/minutes)
> GC grace seconds: 864000
> Compaction min/max thresholds: 4/32
> Read repair chance: 1.0
> Replicate on write: true
> Built indexes: []
> Column Metadata:
> Column Name: session_token
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: state
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: password
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Column Name: birth_year
> Validation Class: org.apache.cassandra.db.marshal.LongType
> Column Name: gender
> Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Keyspace: system:
>
> Able to see the list of keys generate within the CLI
>
> [default@store] list users;
> Using default limit of 100
> -------------------
> RowKey: foo
> => (column=age, value=3339, timestamp=1308182349595000)
> => (column=email, value=foo@email.com, timestamp=1308182349594000)
> => (column=userName, value=foo, timestamp=1308182349591000)
> -------------------
> RowKey: bar
> => (column=email, value=bar@email.com, timestamp=1308182355297000)
> => (column=gender, value=66, timestamp=1308182355299000)
> => (column=userName, value=bar, timestamp=1308182355295000)
> -------------------
> RowKey: tyler
> => (column=email, value=tyler@email.com, timestamp=1308182355303000)
> => (column=sports, value=6261736562616c6c, timestamp=1308182355309000)
> => (column=userName, value=tyler, timestamp=1308182355302000)
>
>
Re: Unable to access column family in CLI after building CF in CQL
Posted by Konstantin Naryshkin <ko...@a-bb.net>.
The second error (the CQL select) is because you have different Key Validation Class values for your two user columns. users is org.apache.cassandra.db.marshal.BytesType, while users2 is org.apache.cassandra.db.marshal.UTF8Type. The select is failing because you are comparing a String to a bunch of bytes.
----- Original Message -----
From: "yikes bigdata" <yi...@gmail.com>
To: user@cassandra.apache.org
Sent: Thursday, June 16, 2011 3:51:41 PM
Subject: Unable to access column family in CLI after building CF in CQL
Hi,
I was following the CQL example on the DataStax website and was able to create a new column family and query it. But when I viewed the column family in the CLI, it gives me the following error.
# Unable to read column family created from CQL
[default@store] list users2;
users2 not found in current keyspace.
Also, when I try to query the user table from CQL, i'm unable to filter on a key. The user table was created in the CLI but accessible by CQL with a simple select * from users;
cqlsh> select * from users where key='tyler';
Bad Request: cannot parse 'tyler' as hex bytes
# In the CLI, the store keyspaces displays two column families .
[default@store] show keyspaces;
Keyspace: store:
Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
Options: [replication_factor:1]
Column Families:
ColumnFamily: users
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.AsciiType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 200000.0/14400
Memtable thresholds: 0.26718749999999997/57/1440 (millions of ops/MB/minutes)
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 1.0
Replicate on write: false
Built indexes: []
Column Metadata:
Column Name: email
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: userName
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
ColumnFamily: users2
Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 200000.0/14400
Memtable thresholds: 0.26718749999999997/57/1440 (millions of ops/MB/minutes)
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 1.0
Replicate on write: true
Built indexes: []
Column Metadata:
Column Name: session_token
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: state
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: password
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Column Name: birth_year
Validation Class: org.apache.cassandra.db.marshal.LongType
Column Name: gender
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Keyspace: system:
Able to see the list of keys generate within the CLI
[default@store] list users;
Using default limit of 100
-------------------
RowKey: foo
=> (column=age, value=3339, timestamp=1308182349595000)
=> (column=email, value= foo@email.com , timestamp=1308182349594000)
=> (column=userName, value=foo, timestamp=1308182349591000)
-------------------
RowKey: bar
=> (column=email, value= bar@email.com , timestamp=1308182355297000)
=> (column=gender, value=66, timestamp=1308182355299000)
=> (column=userName, value=bar, timestamp=1308182355295000)
-------------------
RowKey: tyler
=> (column=email, value= tyler@email.com , timestamp=1308182355303000)
=> (column=sports, value=6261736562616c6c, timestamp=1308182355309000)
=> (column=userName, value=tyler, timestamp=1308182355302000)