You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Martijn van Groningen (Created) (JIRA)" <ji...@apache.org> on 2011/10/02 21:55:33 UTC
[jira] [Created] (LUCENE-3482) Refactor grouping module to be more
maintainable
Refactor grouping module to be more maintainable
------------------------------------------------
Key: LUCENE-3482
URL: https://issues.apache.org/jira/browse/LUCENE-3482
Project: Lucene - Java
Issue Type: Improvement
Components: modules/grouping
Affects Versions: 4.0
Reporter: Martijn van Groningen
Fix For: 4.0
Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Closed] (LUCENE-3482) Refactor grouping module to be more
maintainable
Posted by "Martijn van Groningen (Closed) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn van Groningen closed LUCENE-3482.
-----------------------------------------
Resolution: Won't Fix
Ok I think this issue should be closed. The trade off for more maintainable code has a negative impact on performance that is just a bit too much.
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Issue Comment Edited] (LUCENE-3482) Refactor grouping
module to be more maintainable
Posted by "Martijn van Groningen (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119052#comment-13119052 ]
Martijn van Groningen edited comment on LUCENE-3482 at 10/2/11 8:06 PM:
------------------------------------------------------------------------
Attached initial patch. The patch has a concept named GroupHolder that knowns how to efficiently collect groups. All grouping collectors use that concept to prevent subclassing.
I didn't change the already existing collectors in the grouping module. I added a package research inside the grouping package. I decided to keep the original collectors around to test performance between the original collectors and collectors that use the GroupHolder.
The grouping module depends now on the queries module. I added a method to DocValues to retrieve the ord from a value:
{code}public int ord(MutableValue value) { throw new UnsupportedOperationException(); }{code}
The attached patch also support grouping by bytes IndexDocValues. We already have NumericIndexDocValueSource maybe that can be merged with ByteRefIndexDocDV (included in this patch) into IndexDocValueSource?
was (Author: martijn.v.groningen):
Attached initial patch. The patch has a concept named GroupHolder that knowns how to efficiently collect groups. All grouping collectors use that concept to prevent subclassing.
I didn't change the already existing collectors in the grouping module. I added a package research inside the grouping package. I decided to keep the original collectors around to test performance between the original collectors and collectors that use the GroupHolder.
The grouping module depends now on the queries module. I added a method to DocValues to retrieve the ord from a value:
{code}public int ord(MutableValue value) { throw new UnsupportedOperationException(); }{code}
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3482) Refactor grouping module to be
more maintainable
Posted by "Yonik Seeley (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119073#comment-13119073 ]
Yonik Seeley commented on LUCENE-3482:
--------------------------------------
With respect to some modules depending on other modules, I'm not sure where I stand... some have the opinion that the modules should be independent.
What caught my attention in this issue though is that the refactoring seems extensive enough that we should do performance testing of all the current cases to ensure there are no regressions. Performance is the most important factor here, and I'm not sure if trying to introduce more layers of abstraction (when it's really just an implementation detail) is worth it.
The addition of remove() to SentinelIntSet also seems erroneous:
{code}
+ public void remove(int key) {
+ int s = find(key);
+ if (s >= 0) {
+ count--;
+ keys[s] = emptyVal;
+ }
+ }
{code}
That won't work, as it will foil future lookups for some keys. If we need a Set that supports removal, it should prob be implemented in a different class.
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3482) Refactor grouping module to be
more maintainable
Posted by "Martijn van Groningen (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119225#comment-13119225 ]
Martijn van Groningen commented on LUCENE-3482:
-----------------------------------------------
I will attach some benchmark results in the issue. But in general I saw a performance difference between 0% and 5%. Depending on the query, number of documents and how documents are divided between groups. The question is how much performance penalty is acceptable for a better code design.
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3482) Refactor grouping module to be
more maintainable
Posted by "Martijn van Groningen (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119085#comment-13119085 ]
Martijn van Groningen commented on LUCENE-3482:
-----------------------------------------------
{quote}
What caught my attention in this issue though is that the refactoring seems extensive enough that we should do performance testing of all the current cases to ensure there are no regressions. Performance is the most important factor here, and I'm not sure if trying to introduce more layers of abstraction (when it's really just an implementation detail) is worth it.
{quote}
I agree with you that any negative performance impact should be kept to an absolute minimum. That is why I put the refactored collectors in a research package and kept the unchanged versions around. This allows easy performance comparison.
bq. The addition of remove() to SentinelIntSet also seems erroneous
That shouldn't have made it in the patch. I'm not using this method in any code.
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-3482) Refactor grouping module to be more
maintainable
Posted by "Martijn van Groningen (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn van Groningen updated LUCENE-3482:
------------------------------------------
Attachment: LUCENE-3482.patch
Attached initial patch. The patch has a concept named GroupHolder that knowns how to efficiently collect groups. All grouping collectors use that concept to prevent subclassing.
I didn't change the already existing collectors in the grouping module. I added a package research inside the grouping package. I decided to keep the original collectors around to test performance between the original collectors and collectors that use the GroupHolder.
The grouping module depends now on the queries module. I added a method to DocValues to retrieve the ord from a value:
{code}public int ord(MutableValue value) { throw new UnsupportedOperationException(); }{code}
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3482) Refactor grouping module to be
more maintainable
Posted by "Chris Male (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119119#comment-13119119 ]
Chris Male commented on LUCENE-3482:
------------------------------------
I really have to echo Yonik's concerns here. If we provide too much abstraction and indirection in the code then you're going to see a performance decrease just from method call overhead. This is especially so if the ValueSources contain multiple layers.
> Refactor grouping module to be more maintainable
> ------------------------------------------------
>
> Key: LUCENE-3482
> URL: https://issues.apache.org/jira/browse/LUCENE-3482
> Project: Lucene - Java
> Issue Type: Improvement
> Components: modules/grouping
> Affects Versions: 4.0
> Reporter: Martijn van Groningen
> Fix For: 4.0
>
> Attachments: LUCENE-3482.patch
>
>
> Currently we have 4 types of grouping collectors and 8 concrete subclasses in Lucene / Solr. In current architecture for each type of collector two concrete subclasses need to be created. An implementation optimized for single term based groups and a more general implementation that works with MutableValue to also support grouping by functions. If we want for example group by IndexDocValues each type of grouping collector needs to have three concrete subclasses. This design isn't very maintainable.
> I think it is best to introduce a concept that knows how deals with dealing groups for all the different sources. Therefore the grouping module should depend on the queries module, so that grouping can reuse the ValueSource concept. A term based concrete impl. of this concept knows for example to use the DocValues.ord() method. Or more generic concrete impl. will use DocValues.ValueFiller.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org