You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Dinusha Dilrukshi <sd...@gmail.com> on 2013/02/08 03:04:04 UTC

Why CQL returns data in byte format, while Hive de-serialize and return the data in readable format

Hi,

We are using same underlying column family and extract the data using Hive
query and CQL query.
Column family meta data contains Comparator='IntegerType'
 and default_validation_class = FloatType.

CREATE COLUMN FAMILY cpu_avg_5min
WITH COMPARATOR = 'IntegerType'
 AND key_validation_class = UTF8Type
 AND default_validation_class = FloatType;

Queering through Hive using a Hive query returns readable data while
queering using CQL returns byte format.

Hive query result:
localhost:8282 1350465600 71.0
localhost:8282 1350466500 69.0

CQL query result:
 localhost:8282 | 232340574229062120517680 | 1.0561e-05
 localhost:8282 | 232340574229062137229360 | 2.7594e-06

Can someone explains the above behavior ?

Regards,
DInusha.

Re: Why CQL returns data in byte format, while Hive de-serialize and return the data in readable format

Posted by aaron morton <aa...@thelastpickle.com>.
I suggest trying Int32Type and Double http://www.datastax.com/docs/datastax_enterprise2.1/analytics/about_hive#mapping-hive-external-tables-to-cassandra-column-families

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 8/02/2013, at 10:13 PM, Dinusha Dilrukshi <sd...@gmail.com> wrote:

> 
> [1] If we insert the data using CQL and retrieve using CQL then it returns readable data. (not byte type).
> [2] If we insert the data using hive query and retrieve using hive query, it also returns readable data. (not byte type.) 
> [3] Only if we insert data using hive query and then retrieve the data using CQL, then it returns byte type.
> 
> How data serialization/de-serialization happens in Cassandra. Why [3] returns data in byte format, while same data returns true hive query is not in byte type ?
> 
> Regards,
> Dinusha.
> 
> 
> 
> On Fri, Feb 8, 2013 at 8:39 AM, Edward Capriolo <ed...@gmail.com> wrote:
> In cql3 a column must be all the same type . Since cql transposes columns the only thing they can be is byte array. Cql2 is better at compact tables in. This regard.
> 
> 
> On Thursday, February 7, 2013, Dinusha Dilrukshi wrote:
> Hi,
> 
> We are using same underlying column family and extract the data using Hive query and CQL query. 
> Column family meta data contains Comparator='IntegerType'  and default_validation_class = FloatType.
> 
> CREATE COLUMN FAMILY cpu_avg_5min 
> WITH COMPARATOR = 'IntegerType' 
>  AND key_validation_class = UTF8Type 
>  AND default_validation_class = FloatType;  
> 
> Queering through Hive using a Hive query returns readable data while queering using CQL returns byte format.
> 
> Hive query result:
> localhost:8282 1350465600 71.0 
> localhost:8282 1350466500 69.0 
> 
> CQL query result:
>  localhost:8282 | 232340574229062120517680 | 1.0561e-05 
>  localhost:8282 | 232340574229062137229360 | 2.7594e-06 
> 
> Can someone explains the above behavior ?
> 
> Regards,
> DInusha.
> 


Re: Why CQL returns data in byte format, while Hive de-serialize and return the data in readable format

Posted by Dinusha Dilrukshi <sd...@gmail.com>.
[1] If we insert the data using CQL and retrieve using CQL then it returns
readable data. (not byte type).
[2] If we insert the data using hive query and retrieve using hive query,
it also returns readable data. (not byte type.)
[3] Only if we insert data using hive query and then retrieve the data
using CQL, then it returns byte type.

How data serialization/de-serialization happens in Cassandra. Why [3]
returns data in byte format, while same data returns true hive query is not
in byte type ?

Regards,
Dinusha.



On Fri, Feb 8, 2013 at 8:39 AM, Edward Capriolo <ed...@gmail.com>wrote:

> In cql3 a column must be all the same type . Since cql transposes columns
> the only thing they can be is byte array. Cql2 is better at compact tables
> in. This regard.
>
>
> On Thursday, February 7, 2013, Dinusha Dilrukshi wrote:
>
>> Hi,
>>
>> We are using same underlying column family and extract the data using
>> Hive query and CQL query.
>> Column family meta data contains Comparator='IntegerType'
>>  and default_validation_class = FloatType.
>>
>> CREATE COLUMN FAMILY cpu_avg_5min
>> WITH COMPARATOR = 'IntegerType'
>>  AND key_validation_class = UTF8Type
>>  AND default_validation_class = FloatType;
>>
>> Queering through Hive using a Hive query returns readable data while
>> queering using CQL returns byte format.
>>
>> Hive query result:
>> localhost:8282 1350465600 71.0
>> localhost:8282 1350466500 69.0
>>
>> CQL query result:
>>  localhost:8282 | 232340574229062120517680 | 1.0561e-05
>>  localhost:8282 | 232340574229062137229360 | 2.7594e-06
>>
>> Can someone explains the above behavior ?
>>
>> Regards,
>> DInusha.
>>
>

Re: Why CQL returns data in byte format, while Hive de-serialize and return the data in readable format

Posted by Edward Capriolo <ed...@gmail.com>.
In cql3 a column must be all the same type . Since cql transposes columns
the only thing they can be is byte array. Cql2 is better at compact tables
in. This regard.


On Thursday, February 7, 2013, Dinusha Dilrukshi wrote:

> Hi,
>
> We are using same underlying column family and extract the data using Hive
> query and CQL query.
> Column family meta data contains Comparator='IntegerType'
>  and default_validation_class = FloatType.
>
> CREATE COLUMN FAMILY cpu_avg_5min
> WITH COMPARATOR = 'IntegerType'
>  AND key_validation_class = UTF8Type
>  AND default_validation_class = FloatType;
>
> Queering through Hive using a Hive query returns readable data while
> queering using CQL returns byte format.
>
> Hive query result:
> localhost:8282 1350465600 71.0
> localhost:8282 1350466500 69.0
>
> CQL query result:
>  localhost:8282 | 232340574229062120517680 | 1.0561e-05
>  localhost:8282 | 232340574229062137229360 | 2.7594e-06
>
> Can someone explains the above behavior ?
>
> Regards,
> DInusha.
>