[ 
https://issues.apache.org/jira/browse/CASSANDRA-6102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13780701#comment-13780701
 ] 

Alex Liu commented on CASSANDRA-6102:
-------------------------------------

For regular Cql table e.g.
{code}
CREATE TABLE testm (
  m text,
  n text,
  o text,
  p text,
  q text,
  r text,
  PRIMARY KEY (m, n, o)
)

cqlsh:test> select * from testm;

 m  | n  | o  | p  | q  | r
----+----+----+----+----+----
  m |  n |  o |  p |  q |  r
 m1 | n1 | o1 | p1 | q1 | r1
{code}

the schema and result is 

{code}
(m,{((n,o,),),((n,o,p),p),((n,o,q),q),((n,o,r),r)})
(m1,{((n1,o1,),),((n1,o1,p),p1),((n1,o1,q),q1),((n1,o1,r),r1)})
grunt> describe test3;
test3: {key: chararray,columns: {(name: (),value: bytearray)}}
{code}

System.schema_columns

{code}
qlsh:test> select * from system.schema_columns where keyspace_name='test' and 
columnfamily_name='testm';  

 keyspace_name | columnfamily_name | column_name | component_index | index_name 
| index_options | index_type | validator
---------------+-------------------+-------------+-----------------+------------+---------------+------------+------------------------------------------
          test |             testm |           p |               2 |       null 
|          null |       null | org.apache.cassandra.db.marshal.UTF8Type
          test |             testm |           q |               2 |       null 
|          null |       null | org.apache.cassandra.db.marshal.UTF8Type
          test |             testm |           r |               2 |       null 
|          null |       null | org.apache.cassandra.db.marshal.UTF8Type
{code}

Because the column is composite, so we need use the last component of the 
composite columns to find the validator

                
> CassandraStorage broken for bigints and ints
> --------------------------------------------
>
>                 Key: CASSANDRA-6102
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6102
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Hadoop
>         Environment: Cassandra 1.2.9 & 1.2.10, Pig 0.11.1, OSX 10.8.x
>            Reporter: Janne Jalkanen
>            Assignee: Alex Liu
>         Attachments: 6102-1.2-branch.txt
>
>
> 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:
> {noformat}
> > 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
> {noformat}
> 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):
> {noformat}
> testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
> dump testc
> (foo,(svalue,bar),(ivalue,10),(value,65),{})
> {noformat}
> Cassandra 1.1.10:
> {noformat}
> testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
> dump testc
> (foo,(svalue,bar),(ivalue,10),(value,65),{})
> {noformat}
> Cassandra 1.2.10:
> {noformat}
> (testc = LOAD 'cassandra://keyspace/testc' USING CassandraStorage();
> dump testc
> foo,{(ivalue,
> ),(svalue,bar),(value,A)})
> {noformat}
> 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 
> {noformat}
> tf = foreach testc generate key, 
> flatten(FromCassandraBag('ivalue,svalue,value',columns)) as 
> (ivalue:int,svalue:chararray,lvalue:long);
> dump tf
> (foo,
> ,bar,A)
> {noformat}
> So no help there. Explicitly casting the values to (long) or (int) just 
> results in a ClassCastException.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to