Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-6102

CassandraStorage broken for bigints and ints

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 1.2.11
    • None
    • None
    • Cassandra 1.2.9 & 1.2.10, Pig 0.11.1, OSX 10.8.x

    • Normal

    Description

      I am seeing something rather strange in the way Cass 1.2 + Pig seem to handle integer values.

      Setup: Cassandra 1.2.10, OSX 10.8, JDK 1.7u40, Pig 0.11.1. Single node for testing this.

      First a table:

      > CREATE TABLE testc (
       key text PRIMARY KEY,
       ivalue int,
       svalue text,
       value bigint
      ) WITH COMPACT STORAGE;
      
      > insert into testc (key,ivalue,svalue,value) values ('foo',10,'bar',65);
      > select * from testc;
      
      key | ivalue | svalue | value
      -----+--------+--------+-------
      foo |     10 |    bar |     65
      

      For my Pig setup, I then use libraries from different C* versions to actually talk to my database (which stays on 1.2.10 all the time).

      Cassandra 1.0.12 (using cassandra_storage.jar):

      testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
      dump testc
      (foo,(svalue,bar),(ivalue,10),(value,65),{})
      

      Cassandra 1.1.10:

      testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
      dump testc
      (foo,(svalue,bar),(ivalue,10),(value,65),{})
      

      Cassandra 1.2.10:

      (testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
      dump testc
      foo,{(ivalue,
      ),(svalue,bar),(value,A)})
      

      To me it appears that ints and bigints are interpreted as ascii values in cass 1.2.10. Did something change for CassandraStorage, is there a regression, or am I doing something wrong? Quick perusal of the JIRA didn't reveal anything that I could directly pin on this.

      Note that using compact storage does not seem to affect the issue, though it obviously changes the resulting pig format.

      In addition, trying to use Pygmalion

      tf = foreach testc generate key, flatten(FromCassandraBag('ivalue,svalue,value',columns)) as (ivalue:int,svalue:chararray,lvalue:long);
      dump tf
      
      (foo,
      ,bar,A)
      

      So no help there. Explicitly casting the values to (long) or (int) just results in a ClassCastException.

      Attachments

        1. 6102-2.0-branch.txt
          16 kB
          Alex Liu
        2. 6102-v5.txt
          17 kB
          Alex Liu
        3. 6102-v4.txt
          17 kB
          Alex Liu
        4. 6102-v3.txt
          16 kB
          Alex Liu
        5. 6102-v2.txt
          7 kB
          Brandon Williams
        6. 6102-1.2-branch.txt
          7 kB
          Alex Liu

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            alexliu68 Alex Liu Assign to me
            jalkanen Janne Jalkanen
            Alex Liu
            Brandon Williams
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment