-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IntGrouper to avoid unnecessary boxing/unboxing in array-based aggregation #4668
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also benchmark results would be useful
/** | ||
* {@link Grouper} specialized for the primitive int type | ||
*/ | ||
public interface IntGrouper extends Grouper<Integer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this interface have only one implementation, maybe get rid of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking to add a new grouper which doing merge aggregation for sorted data. This interface will be worthwhile.
*/ | ||
public interface IntGrouper extends Grouper<Integer> | ||
{ | ||
default AggregateResult aggregate(int key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that this default method is used only from other default method, suggested to inline it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used in ArrayAggregateIterator as well.
} | ||
|
||
@Override | ||
default IntGrouperHashFunction hashFunction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only implementation overrides this method, suggested to remove default implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Removed.
@leventov sure, here it is. I added a new benchmark query because there wasn't a query having a single grouping key except
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
IIRC, this was discussed in #4576.
This change is