FAQ
It's been some while since I started using Cassandra in combination with
Pig, but I still haven't figured out the best way to work with the data. I
wrote some Index Readers based on the format that the contributed
CassandraStorage introduced (a tuple of the key and a databag which in turn
holds key-value tuples for the columns), but my Pig scripts by using this
method my scripts are riddled with $-signs:

C1 = order rows by $1.$4.$1;

which continually break down as soon as I add some more columns to my CF. I
was working on a converter that takes the above mentioned format and
converted it to a Map<String, Object> but to no avail since when trying to
work on it, I bump my head against these:

java.lang.ClassCastException: java.util.HashMap cannot be cast to
org.apache.pig.data.Tuple

as soon as I make this:

crows = FOREACH rows GENERATE CassandraConvert($0,$1)

scrows = FOREACH crows GENERATE $0.uid;


I would really love to have a simple way to address the fields of a row,
like in the case of loading from a file and assigning names, but I cannot
understand how to be achieve this.
Anyone having similar problems, or even better, a solution they'd like to
share?

Regards,
Chris

Search Discussions

  • Thejas M Nair at Sep 27, 2010 at 1:40 pm

    On 9/26/10 8:46 AM, "Christian Decker" wrote:

    It's been some while since I started using Cassandra in combination with
    Pig, but I still haven't figured out the best way to work with the data. I
    wrote some Index Readers based on the format that the contributed
    CassandraStorage introduced (a tuple of the key and a databag which in turn
    holds key-value tuples for the columns), but my Pig scripts by using this
    method my scripts are riddled with $-signs:

    C1 = order rows by $1.$4.$1;

    which continually break down as soon as I add some more columns to my CF. I
    was working on a converter that takes the above mentioned format and
    converted it to a Map<String, Object> but to no avail since when trying to
    work on it, I bump my head against these:

    java.lang.ClassCastException: java.util.HashMap cannot be cast to
    org.apache.pig.data.Tuple

    as soon as I make this:

    crows = FOREACH rows GENERATE CassandraConvert($0,$1)

    scrows = FOREACH crows GENERATE $0.uid;


    Does CassandraConvert return Map<String,Object> ? In that case your pig
    statement should be -

    scrows = FOREACH crows GENERATE $0#'uid';



    -Thejas

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedSep 26, '10 at 3:47p
activeSep 27, '10 at 1:40p
posts2
users2
websitepig.apache.org

2 users in discussion

Thejas M Nair: 1 post Christian Decker: 1 post

People

Translate

site design / logo © 2021 Grokbase