cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: getFieldValue()
Date Fri, 17 Jun 2011 15:55:26 GMT
If you don't get frustrated writing Thrift by hand you are a far, far
more patient man than I am.

It's tedious and error-prone to boot.

On Fri, Jun 17, 2011 at 10:30 AM, Markus Wiesenbacher | Codefreun.de
<mw@codefreun.de> wrote:
> One question regarding point 2: Why should we always use Hector, Thrift is not that bad?
>
> Von meinem iPhone gesendet
>
> Am 17.06.2011 um 17:12 schrieb Jonathan Ellis <jbellis@gmail.com>:
>
>> 1. the right way to right that is to just say struct.name, struct.value, etc
>> 2. why are you writing raw thrift instead of using Hector?
>>
>> On Fri, Jun 17, 2011 at 5:03 AM, Vivek Mishra
>> <vivek.mishra@impetus.co.in> wrote:
>>>
>>>
>>>
>>>
>>> From: Vivek Mishra
>>> Sent: Friday, June 17, 2011 3:25 PM
>>> To: user@cassandra.apache.org
>>> Subject: getFieldValue()
>>>
>>>
>>>
>>> Hi,
>>>
>>> I was looking into  getFieldValue method for SuperColumn and SlicePredicate
>>> apis.
>>>
>>>
>>>
>>> It looks to me slight confusing as underlying APIs are returning Object and
>>> developer can only be aware of type of object either by looking into
>>> Cassandra code base or by ClassCastException.
>>>
>>>
>>>
>>> For example,
>>>
>>>
>>>
>>> I need to retrieve column name  and it’s value for a SuperColumnFamily
>>> “SuperCli” is:
>>>
>>>
>>>
>>>
>>>
>>> List<KeySlice> keySlices = cassndraClient.get_range_slices(new ColumnParent(
>>>
>>>                         "SuperCli"), slicePredicate, keyRange,
>>> ConsistencyLevel.ONE);
>>>
>>>             System.out.println(keySlices.size()
>>>
>>>                         + " No. of rows exist for the column family:"
+
>>> "SuperCli");
>>>
>>>             for( KeySlice slice :keySlices)
>>>
>>>             {
>>>
>>>                   city = "noida";
>>>
>>> System.out.println(new String((byte[])
>>> (slice.getColumns().get(0).getSuper_column().getFieldValue(org.apache.cassandra.thrift.SuperColumn._Fields.NAME))).toString());
>>>
>>>             }
>>>
>>>
>>>
>>>
>>>
>>> Am I doing something wrong or such typecasting is must? Shouldn’t we hide
>>> this complexity and handle it implicitly in CASSANDRA? Or may be introducing
>>> a Helper Class can reduce such amount of code ?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Is it possible to retrieve a specific SuperColumn by specifying it’s value
>>> in SliceRange query?
>>>
>>>
>>>
>>> I can’t see any method with  such search API and I believe it is a real time
>>> scenario.
>>>
>>>
>>>
>>> SuperCli is a super column family holding number of dynamic super columns.
>>>
>>>
>>>
>>> ________________________________
>>> Write to us for a Free Gold Pass to the Cloud Computing Expo, NYC to attend
>>> a live session by Head of Impetus Labs on ‘Secrets of Building a Cloud
>>> Vendor Agnostic PetaByte Scale Real-time Secure Web Application on the Cloud
>>> ‘.
>>>
>>> Looking to leverage the Cloud for your Big Data Strategy ? Attend Impetus
>>> webinar on May 27 by registering at
>>> http://www.impetus.com/webinar?eventid=42 .
>>>
>>>
>>> NOTE: This message may contain information that is confidential,
>>> proprietary, privileged or otherwise protected by law. The message is
>>> intended solely for the named addressee. If received in error, please
>>> destroy and notify the sender. Any use of this email is prohibited when
>>> received in error. Impetus does not represent, warrant and/or guarantee,
>>> that the integrity of this communication has been maintained nor that the
>>> communication is free of errors, virus, interception or interference.
>>>
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of DataStax, the source for professional Cassandra support
>> http://www.datastax.com
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Mime
View raw message