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

Todd Nine commented on CASSANDRA-2231:
--------------------------------------

Hi Sylvain,
  I seem to have encountered a bug in the comparator.  I'm using the composite 
to perform Cassandra based intersections of fields during queries.  For 
instance, say a user defines an index as this.

status + unitId.


The write would always contain values of <status>+0+<unitId>+0 when using the 
-1 0 and 1 fields.  If the user enters a query such as this


status > 100 && status < 300 && unitId = 10

I would need to construct a column scan of the following to get  correct result 
sets.

start => 100+1+10+0

end => 300+0+10+1


However on in the validate function I'm receiving the error "Invalid bytes 
remaining after an end-of-component at component".  This seems incorrect to me. 
 We're ultimately attempting to apply any equality operand and transform it to 
a range scan for the given field in the composite.  This means that -1, or 1 
could appear after any component in the composite, not just the last one.  Can 
you please add this functionality/remove this verification check?

Thanks,
Todd

> Add CompositeType comparer to the comparers provided in 
> org.apache.cassandra.db.marshal
> ---------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2231
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2231
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Contrib
>    Affects Versions: 0.7.3
>            Reporter: Ed Anuff
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.7.5
>
>         Attachments: CompositeType-and-DynamicCompositeType.patch, 
> edanuff-CassandraCompositeType-1e253c4.zip
>
>
> CompositeType is a custom comparer that makes it possible to create 
> comparable composite values out of the basic types that Cassandra currently 
> supports, such as Long, UUID, etc.  This is very useful in both the creation 
> of custom inverted indexes using columns in a skinny row, where each column 
> name is a composite value, and also when using Cassandra's built-in secondary 
> index support, where it can be used to encode the values in the columns that 
> Cassandra indexes.  One scenario for the usage of these is documented here: 
> http://www.anuff.com/2010/07/secondary-indexes-in-cassandra.html.  Source for 
> contribution is attached and has been previously maintained on github here: 
> https://github.com/edanuff/CassandraCompositeType

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to