You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Janwar Dinata <j....@gmail.com> on 2012/04/08 05:02:17 UTC

issue with composite row key on CassandraStorage pig?

Hi,

I have a column family that uses DynamicCompositeType for its
keys_validation_class.
When I try to dump the row keys using pig but it fails
with java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot
be cast to org.apache.pig.data.Tuple

This is how I create the column family
create column family CompoKey
       with
         key_validation_class =
           'DynamicCompositeType(
                     a=>AsciiType,
                     o=>BooleanType,
                     b=>BytesType,
                     e=>DateType,
                     d=>DoubleType,
                     f=>FloatType,
                     i=>IntegerType,
                     x=>LexicalUUIDType,
                     l=>LongType,
                     t=>TimeUUIDType,
                     s=>UTF8Type,
                     u=>UUIDType)' and
         comparator =
           'DynamicCompositeType(
                     a=>AsciiType,
                     o=>BooleanType,
                     b=>BytesType,
                     e=>DateType,
                     d=>DoubleType,
                     f=>FloatType,
                     i=>IntegerType,
                     x=>LexicalUUIDType,
                     l=>LongType,
                     t=>TimeUUIDType,
                     s=>UTF8Type,
                     u=>UUIDType)' and
         default_validation_class = CounterColumnType;

This is my pig script
rows =  LOAD 'cassandra://PigTest/CompoKey' USING CassandraStorage();
keys = FOREACH rows GENERATE flatten(key);
dump keys;

I'm on cassandra 1.0.9 and pig 0.9.2.

Thanks.

Re: issue with composite row key on CassandraStorage pig?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
There doesn't seem to be an open JIRA ticket for it - can you please make one at https://issues.apache.org/jira/browse/CASSANDRA? That ensures that at some point someone will take a look at it and it just won't be forgotten in the endless barrage of emails...

Yup, I did the composite columns support. I'd start by looking at CassandraStorage.getNext().

/Janne

On 9 Apr 2012, at 22:02, Janwar Dinata wrote:

> Hi Janne,
> 
> Do you happen to know if support for composite row key is in the pipeline?
> 
> It seems that you did a patch for composite columns support on CassandraStorage.java.
> Do you have any pointers for implementing composite row key feature?
> 
> Thanks.
> 
> On Mon, Apr 9, 2012 at 11:32 AM, Janne Jalkanen <Ja...@ecyrd.com> wrote:
> 
> I don't think the Pig code supports Composite *keys* yet. The 1.0.9 code supports Composite Column Names tho'...
> 
> /Janne
> 
> On Apr 8, 2012, at 06:02 , Janwar Dinata wrote:
> 
>> Hi,
>> 
>> I have a column family that uses DynamicCompositeType for its keys_validation_class.
>> When I try to dump the row keys using pig but it fails with java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot be cast to org.apache.pig.data.Tuple
>> 
>> This is how I create the column family
>> create column family CompoKey
>>        with
>>          key_validation_class =
>>            'DynamicCompositeType(
>>                      a=>AsciiType,
>>                      o=>BooleanType,
>>                      b=>BytesType,
>>                      e=>DateType,
>>                      d=>DoubleType,
>>                      f=>FloatType,
>>                      i=>IntegerType,
>>                      x=>LexicalUUIDType,
>>                      l=>LongType,
>>                      t=>TimeUUIDType,
>>                      s=>UTF8Type,
>>                      u=>UUIDType)' and
>>          comparator =
>>            'DynamicCompositeType(
>>                      a=>AsciiType,
>>                      o=>BooleanType,
>>                      b=>BytesType,
>>                      e=>DateType,
>>                      d=>DoubleType,
>>                      f=>FloatType,
>>                      i=>IntegerType,
>>                      x=>LexicalUUIDType,
>>                      l=>LongType,
>>                      t=>TimeUUIDType,
>>                      s=>UTF8Type,
>>                      u=>UUIDType)' and
>>          default_validation_class = CounterColumnType;   
>> 
>> This is my pig script
>> rows =  LOAD 'cassandra://PigTest/CompoKey' USING CassandraStorage();
>> keys = FOREACH rows GENERATE flatten(key);
>> dump keys;
>> 
>> I'm on cassandra 1.0.9 and pig 0.9.2.
>> 
>> Thanks.
> 
> 


Re: issue with composite row key on CassandraStorage pig?

Posted by Janwar Dinata <j....@gmail.com>.
Hi Janne,

Do you happen to know if support for composite row key is in the pipeline?

It seems that you did a patch for composite columns support on
CassandraStorage.java.
Do you have any pointers for implementing composite row key feature?

Thanks.

On Mon, Apr 9, 2012 at 11:32 AM, Janne Jalkanen <Ja...@ecyrd.com>wrote:

>
> I don't think the Pig code supports Composite *keys* yet. The 1.0.9 code
> supports Composite Column Names tho'...
>
> /Janne
>
> On Apr 8, 2012, at 06:02 , Janwar Dinata wrote:
>
> Hi,
>
> I have a column family that uses DynamicCompositeType for its
> keys_validation_class.
> When I try to dump the row keys using pig but it fails
> with java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot
> be cast to org.apache.pig.data.Tuple
>
> This is how I create the column family
> create column family CompoKey
>        with
>          key_validation_class =
>            'DynamicCompositeType(
>                      a=>AsciiType,
>                      o=>BooleanType,
>                      b=>BytesType,
>                      e=>DateType,
>                      d=>DoubleType,
>                      f=>FloatType,
>                      i=>IntegerType,
>                      x=>LexicalUUIDType,
>                      l=>LongType,
>                      t=>TimeUUIDType,
>                      s=>UTF8Type,
>                      u=>UUIDType)' and
>          comparator =
>            'DynamicCompositeType(
>                      a=>AsciiType,
>                      o=>BooleanType,
>                      b=>BytesType,
>                      e=>DateType,
>                      d=>DoubleType,
>                      f=>FloatType,
>                      i=>IntegerType,
>                      x=>LexicalUUIDType,
>                      l=>LongType,
>                      t=>TimeUUIDType,
>                      s=>UTF8Type,
>                      u=>UUIDType)' and
>          default_validation_class = CounterColumnType;
>
> This is my pig script
> rows =  LOAD 'cassandra://PigTest/CompoKey' USING CassandraStorage();
> keys = FOREACH rows GENERATE flatten(key);
> dump keys;
>
> I'm on cassandra 1.0.9 and pig 0.9.2.
>
> Thanks.
>
>
>

Re: issue with composite row key on CassandraStorage pig?

Posted by Janne Jalkanen <Ja...@ecyrd.com>.
I don't think the Pig code supports Composite *keys* yet. The 1.0.9 code supports Composite Column Names tho'...

/Janne

On Apr 8, 2012, at 06:02 , Janwar Dinata wrote:

> Hi,
> 
> I have a column family that uses DynamicCompositeType for its keys_validation_class.
> When I try to dump the row keys using pig but it fails with java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot be cast to org.apache.pig.data.Tuple
> 
> This is how I create the column family
> create column family CompoKey
>        with
>          key_validation_class =
>            'DynamicCompositeType(
>                      a=>AsciiType,
>                      o=>BooleanType,
>                      b=>BytesType,
>                      e=>DateType,
>                      d=>DoubleType,
>                      f=>FloatType,
>                      i=>IntegerType,
>                      x=>LexicalUUIDType,
>                      l=>LongType,
>                      t=>TimeUUIDType,
>                      s=>UTF8Type,
>                      u=>UUIDType)' and
>          comparator =
>            'DynamicCompositeType(
>                      a=>AsciiType,
>                      o=>BooleanType,
>                      b=>BytesType,
>                      e=>DateType,
>                      d=>DoubleType,
>                      f=>FloatType,
>                      i=>IntegerType,
>                      x=>LexicalUUIDType,
>                      l=>LongType,
>                      t=>TimeUUIDType,
>                      s=>UTF8Type,
>                      u=>UUIDType)' and
>          default_validation_class = CounterColumnType;   
> 
> This is my pig script
> rows =  LOAD 'cassandra://PigTest/CompoKey' USING CassandraStorage();
> keys = FOREACH rows GENERATE flatten(key);
> dump keys;
> 
> I'm on cassandra 1.0.9 and pig 0.9.2.
> 
> Thanks.