Writing Data To A Super Column That Is In A Column Family With A Type Of Standard

147 views
Skip to first unread message

wingleberry

unread,
Mar 1, 2012, 4:52:16 PM3/1/12
to Scale 7 - Libraries and systems for scalable computing
I have not been able to figure out how to get the Pelops client to
write to a super column that is in a column family with a type of
Standard.

I am successfully writing standard columns that are in a column family
with a type of Standard. I am also successfully writing to super
columns that are in a column family with a type of Super.

My code throws the following exception: Exception in thread "main"
org.scale7.cassandra.pelops.exceptions.InvalidRequestException:
supercolumn parameter is invalid for standard CF .

In the 1.0 documentation here, http://www.datastax.com/docs/1.0/ddl/column_family,
it says that "A Cassandra column family can contain either regular
columns or super columns, which adds another level of nesting to the
regular column family structure" so it looks like it should be
possible, but the Mutator.writeSubColumns() method does not seem to
work and throws the exception above.

What am I doing wrong?

Thanks!

cb

Andrew Swan

unread,
Mar 1, 2012, 6:06:47 PM3/1/12
to sca...@googlegroups.com
A given Cassandra column family can either contain standard columns or super columns, but not a mixture of the two. This is nothing to do with Pelops or any client library, it's a feature of Cassandra. I can see how the doco was ambiguous in its use of the word "or" in this case.

Cheers,

Andrew
--
"If I have not seen as far as others, it is because giants were standing on my shoulders."

wingleberry

unread,
Mar 2, 2012, 10:01:14 AM3/2/12
to Scale 7 - Libraries and systems for scalable computing
Thanks for the reply. It makes sense to me, but one of our other
developers has created a table with the following script and he seems
to be mixing super and standard columns. Also, when I use the CLI to
query the data, the columns marked as super has hashes for their
values. What am I missing?

Here's the script:

create column family users
with comparator = UTF8T
and key_validation_class=UTF8TYpe
and compression_options = { sstable_compression:SnappyCompressor,
chunk_length_kb:64}
and column_metadata = [
{ column_name: FirstName, validation_class : UTF8Type},
{ column_name: LastName, validation_class : UTF8Type},
{ column_name: FavStore, validation_class : IntegerType},
{ column_type: super, column_name: HomeAddress
, column_metadata = [
{ column_name: Street, validation_class : UTF8Type},
{ column_name: State, validation_class : UTF8Type},
{ column_name: Zip, validation_class : LongType} ] },
{ column_type: super, column_name: WorkAddress
, column_metadata = [
{ column_name: Street, validation_class : UTF8Type},
{ column_name: State, validation_class : UTF8Type},
{ column_name: Zip, validation_class : LongType} ] },
{ column_type: super, column_name: Favorites }
];

And here's the CLI output:

list users;
Using default limit of 100
-------------------
RowKey: bobjones
=> (column=FavStore, value=59580595188280, timestamp=1330696438)
=> (column=Favorites, value=HASH(0x3618bc0), timestamp=1330696438)
=> (column=FirstName, value=Bob, timestamp=1330696438)
=> (column=HomeAddress, value=HASH(0x3618b30), timestamp=1330696438)
=> (column=LastName, value=Jones, timestamp=1330696438)
=> (column=WorkAddress, value=HASH(0x3619688), timestamp=1330696438)

If this is just a standard column family, how do I write to and read
from the "super" columns with the hash values?

Thanks!

cb



On Mar 1, 5:06 pm, Andrew Swan <andrew.i.s...@gmail.com> wrote:
> A given Cassandra column family can either contain standard columns or
> super columns, but not a mixture of the two. This is nothing to do with
> Pelops or any client library, it's a feature of Cassandra. I can see how
> the doco was ambiguous in its use of the word "or" in this case.
>
> Cheers,
>
> Andrew
>
> On 2 March 2012 08:52, wingleberry <cbowl...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > I have not been able to figure out how to get the Pelops client to
> > write to a super column that is in a column family with a type of
> > Standard.
>
> > I am successfully writing standard columns that are in a column family
> > with a type of Standard. I am also successfully writing to super
> > columns that are in a column family with a type of Super.
>
> > My code throws the following exception: Exception in thread "main"
> > org.scale7.cassandra.pelops.exceptions.InvalidRequestException:
> > supercolumn parameter is invalid for standard CF .
>
> > In the 1.0 documentation here,
> >http://www.datastax.com/docs/1.0/ddl/column_family,
> > it says that "A Cassandra column family can contain either regular
> > columns or super columns, which adds another level of nesting to the
> > regular column family structure" so it looks like it should be
> > possible, but the Mutator.writeSubColumns() method does not seem to
> > work and throws the exception above.
>
> > What am I doing wrong?
>
> > Thanks!
>
> > cb
>
> --
> *"If I have not seen as far as others, it is because giants were standing
> on my shoulders."
> ***

Dan Washusen

unread,
Mar 2, 2012, 3:28:23 PM3/2/12
to sca...@googlegroups.com
I'm with Andrew on this one; I don't think it's possible. However, Pelops doesn't do anything special with writing and reading - if you attempt to write a supper column then Pelops attempts to write a super column, same for a standard column…

I'd suggest contacting the cassandra users list, I'll keep an eye out and chime in with any pelops specific comments…

Cheers,
Dan
Reply all
Reply to author
Forward
0 new messages