mkjellman / perlcassa

a Perl client for Apache Cassandra
Apache License 2.0
20 stars 12 forks source link

Composite Columns Key Retrieval #19

Open larsx2 opened 11 years ago

larsx2 commented 11 years ago

Is there any way to retrieve rows with a CompositeType as key on perlcassa? I have not seen that use case on the examples yet.

mkjellman commented 11 years ago

Could you post a cf schema that your looking to query just to make sure i totally understand the request? Thanks

larsx2 commented 11 years ago

Let's suppose i want to retrieve a row with this key:

RowKey: 2009-04-19 22:40:25-0900:smtp.usma.bluenet.:10.1.60.25:A:167853061:667da0075b5a14c65eff0b25308cf072 => (column=answer, value=10.1.60.25, timestamp=1359759908728109) ....

The row key is made from multiple columns (date, query, answer, type, dst_ip, checksum) the Column Family in this case is defined as:

CREATE COLUMN FAMILY dns WITH comparator = 'UTF8Type' AND key_validation_class = 'CompositeType(DateType, UTF8Type, UTF8Type, UTF8Type, DecimalType, UTF8Type)' AND compression_options = {sstable_compression: SnappyCompressor} and column_metadata = [ {column_name: src_ip, validation_class: DecimalType}, {column_name: dst_ip, validation_class: DecimalType}, {column_name: query, validation_class: UTF8Type}, {column_name: type, validation_class: UTF8Type}, {column_name: answer, validation_class: UTF8Type}, {column_name: rr_class, validation_class: UTF8Type}, {column_name: date, validation_class: DateType}, {column_name: checksum, validation_class: UTF8Type} ];

As described, how would i fetch an specific row using perlcassa?

mkjellman commented 11 years ago

honestly, I never thought of using a CompositeType in a key. I assume your just doing that to validate your input for the key name?

Should be pretty easy for me to add in though.

larsx2 commented 11 years ago

It would be AWESOME if you can add support for it :)

dmcnelis commented 11 years ago

@mkjellman Do you still plan to implement this, and if so, any idea when you might get to it?

mkjellman commented 11 years ago

@dmcnelis apologies on the delay. i'll try to get something committed into trunk todayish

dmcnelis commented 11 years ago

Awesomeness!

swatidhoke commented 11 years ago

Hi ... this would be great..can you also add support for row key as long data type ..i have also added my issue separately