You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "Hagos, A.S." <A....@tue.nl> on 2012/10/18 14:24:46 UTC

how to get column type?

Hi all,
I am wondering if there is a way to know the column type of an already stored value in  Cassandra.
My specific case is to get a column value of a known column name but not type.

greetings 
Ambes

Re: how to get column type?

Posted by aaron morton <aa...@thelastpickle.com>.
It depends if C* knows about the column. 

You can check this by looking at the schema in cassandra-cli, see the online help for show schema. 

AFAIK most higher level libraries will get the data type info via the API. They use this to determine the wire format for serialisation. Crack open the client for in your chosen language and take a look if you need programatic access. 

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 19/10/2012, at 1:40 AM, "Hiller, Dean" <De...@nrel.gov> wrote:

> This is specifically why Cassandra and even PlayOrm are going the
> direction of "partial schemas".  Everything in cassandra in raw form is
> just bytes.  If you don't tell it the types, it doesn't know how to
> translate it.  PlayOrm and other ORM layers are the same way though in
> these noSQL ORMs you typically have a schema where it is sort of like this
> 
> If(colName.equals("name"))
>   return String.class;
> else if(colName.equals("age"))
>   Return Integer.class;
> 
> So column values are typed such that a command line tool like PlayOrm's
> command line tool can query and know how to translate the results.  Any
> parts of the schema that are not known are just returned in hex.
> 
> So schemaless is cool, but sometimes it is a big pain as well.
> 
> Dean
> 
> On 10/18/12 6:24 AM, "Hagos, A.S." <A....@tue.nl> wrote:
> 
>> Hi all,
>> I am wondering if there is a way to know the column type of an already
>> stored value in  Cassandra.
>> My specific case is to get a column value of a known column name but not
>> type.
>> 
>> greetings 
>> Ambes
> 


Re: how to get column type?

Posted by "Hiller, Dean" <De...@nrel.gov>.
This is specifically why Cassandra and even PlayOrm are going the
direction of "partial schemas".  Everything in cassandra in raw form is
just bytes.  If you don't tell it the types, it doesn't know how to
translate it.  PlayOrm and other ORM layers are the same way though in
these noSQL ORMs you typically have a schema where it is sort of like this

If(colName.equals("name"))
   return String.class;
else if(colName.equals("age"))
   Return Integer.class;

So column values are typed such that a command line tool like PlayOrm's
command line tool can query and know how to translate the results.  Any
parts of the schema that are not known are just returned in hex.

So schemaless is cool, but sometimes it is a big pain as well.

Dean

On 10/18/12 6:24 AM, "Hagos, A.S." <A....@tue.nl> wrote:

>Hi all,
>I am wondering if there is a way to know the column type of an already
>stored value in  Cassandra.
>My specific case is to get a column value of a known column name but not
>type.
>
>greetings 
>Ambes