You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2011/03/18 15:53:29 UTC

[jira] Created: (CASSANDRA-2355) Have an easy way to define the reverse comparator of any comparator

Have an easy way to define the reverse comparator of any comparator
-------------------------------------------------------------------

                 Key: CASSANDRA-2355
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
             Project: Cassandra
          Issue Type: Improvement
          Components: Core
            Reporter: Sylvain Lebresne
            Assignee: Sylvain Lebresne
            Priority: Minor




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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Attachment: Allow-comparators-to-take-arguments-ReversedType.patch

Attaching patch against 0.7.

It may be important to keep in mind that once you use a comparator with arguments, your node become network incompatible with older nodes, since those older nodes won't be able to understand the comparator shipping in new schema migrations. 

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.7.5
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Fix Version/s:     (was: 0.8)
                   0.8.1
       Issue Type: New Feature  (was: Improvement)

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8.1
>
>         Attachments: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch, Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Fix Version/s:     (was: 1.0)
                   0.8

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch, Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Attachment: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch

Attached v3 (v3 is for coherence with CASSANDRA-2231) is rebased on 0.8.

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 1.0
>
>         Attachments: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch, Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Attachment: 0001-Allow-comparators-to-take-arguments-ReversedType_0.7.patch

Attaching companion patch for the 0.7 version of CASSANDRA-2231. See the comment there.

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8.1
>
>         Attachments: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch, 0001-Allow-comparators-to-take-arguments-ReversedType_0.7.patch, Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Commented] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017676#comment-13017676 ] 

Jonathan Ellis commented on CASSANDRA-2355:
-------------------------------------------

Are there any other uses for comparator options?

If not perhaps this approach is premature generalization.

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Commented] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021589#comment-13021589 ] 

Jonathan Ellis commented on CASSANDRA-2355:
-------------------------------------------

+1

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 1.0
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

      Description: 
Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
CASSANDRA-2231 provides another use case for this.

This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.
    Fix Version/s: 0.7.5
          Summary: Allow parameters for comparator  (was: Have an easy way to define the reverse comparator of any comparator)

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.7.5
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-2355:
--------------------------------------

    Fix Version/s:     (was: 0.7.5)
                   0.8

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Commented] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009137#comment-13009137 ] 

Jonathan Ellis commented on CASSANDRA-2355:
-------------------------------------------

... never mind, it's totally reasonable to say "don't create a comparator w/ this new feature until you've upgraded the entire cluster"

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.7.5
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Commented] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009136#comment-13009136 ] 

Jonathan Ellis commented on CASSANDRA-2355:
-------------------------------------------

Wouldn't this be more appropriate for 0.8 then?

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.7.5
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Updated] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-2355:
----------------------------------------

    Attachment: 0001-Allow-comparators-to-take-arguments-ReversedType-v4.patch

Attaching v4 that is rebased against current trunk.

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8.1
>
>         Attachments: 0001-Allow-comparators-to-take-arguments-ReversedType-v3.patch, 0001-Allow-comparators-to-take-arguments-ReversedType-v4.patch, 0001-Allow-comparators-to-take-arguments-ReversedType_0.7.patch, Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] [Commented] (CASSANDRA-2355) Allow parameters for comparator

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017690#comment-13017690 ] 

Sylvain Lebresne commented on CASSANDRA-2355:
---------------------------------------------

bq. Are there any other uses for comparator options?

The idea was to allow reversed comparator, and the composite types and more importantly both those together. In particular this improves slightly I believe the parsing for the composite types themselves. The fact that it is generic also makes use usable for custom comparator. There was also some idea of generalizing existing comparator hinted in the comment above. But for exemple, we could easily have a TextComparator(charset='whatever'), which could be cool. Or a TextComparator(regexp='...') who would validate only entry matching some regexp. Maybe that last one is not so useful, I don't know, but I do believe that it opens a bunch of interesting possibility. 

> Allow parameters for comparator
> -------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: Allow-comparators-to-take-arguments-ReversedType.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Being able to provide arguments to a comparator, to parametrize its behavior, can be useful.
> For example, a generic ReverseComparator is trivial to write, but without the ability to provide arguments at the comparator constriction, it cannot be used.
> CASSANDRA-2231 provides another use case for this.
> This ticket proposes to introduce a parser for comparator definition that supports optional parameters and to introduce a generic ReverseType as a simple example of this.

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

[jira] Commented: (CASSANDRA-2355) Have an easy way to define the reverse comparator of any comparator

Posted by "Ed Anuff (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13008510#comment-13008510 ] 

Ed Anuff commented on CASSANDRA-2355:
-------------------------------------

In Cassandra-2231 it was suggested that this be implemented by making comparators parameterizable.  The idea would be to perhaps replace FBUtilities.getComparator() with a ComparatorFactory that could be passed something like "UUIDType(restrictTo=time,sort=desc)" and parse out the parameters in order to construct the instance.  For Cassandra-2231, the proposed patch requires that FBUtilities.getComparator() caches and returns the same singleton comparator instances, so that requesting "UUIDType" will always return the same instance.  It would be necessary to cache the parameterized version in a similar way, and would probably need to be able to know that "UUIDType(restrictTo=time,sort=desc)" and "UUIDType(sort=desc,restrictTo=time)" should return the same cached comparator.

> Have an easy way to define the reverse comparator of any comparator
> -------------------------------------------------------------------
>
>                 Key: CASSANDRA-2355
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2355
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>


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