You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/11/16 16:47:41 UTC

[GitHub] [pinot] richardstartin opened a new pull request #7777: peel off special case for 1 dimensional groupby

richardstartin opened a new pull request #7777:
URL: https://github.com/apache/pinot/pull/7777


   ## Description
   <!-- Add a description of your PR here.
   A good description should include pointers to an issue or design document, etc.
   -->
   ## Upgrade Notes
   Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
   * [ ] Yes (Please label as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR fix a zero-downtime upgrade introduced earlier?
   * [ ] Yes (Please label this as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR otherwise need attention when creating release notes? Things to consider:
   - New configuration options
   - Deprecation of configurations
   - Signature changes to public methods/interfaces
   - New plugins added or old plugins removed
   * [ ] Yes (Please label this PR as **<code>release-notes</code>** and complete the section on Release Notes)
   ## Release Notes
   <!-- If you have tagged this as either backward-incompat or release-notes,
   you MUST add text here that you would like to see appear in release notes of the
   next release. -->
   
   <!-- If you have a series of commits adding or enabling a feature, then
   add this section only in final commit that marks the feature completed.
   Refer to earlier release notes to see examples of text.
   -->
   ## Documentation
   <!-- If you have introduced a new feature or configuration, please add it to the documentation as well.
   See https://docs.pinot.apache.org/developers/developers-and-contributors/update-document
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] richardstartin commented on a change in pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7777:
URL: https://github.com/apache/pinot/pull/7777#discussion_r751782162



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -587,6 +617,20 @@ public LongMapBasedHolder(Long2IntOpenHashMap groupIdMap) {
 
     @Override
     public void processSingleValue(int numDocs, int[] outGroupIds) {
+      if (_numGroupByExpressions == 1) {

Review comment:
       Ok I will roll this back, the change was motivated by the int cases I found in profiles and I added this for consistency.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] richardstartin commented on a change in pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7777:
URL: https://github.com/apache/pinot/pull/7777#discussion_r751781127



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -253,12 +252,29 @@ public int getNumKeys() {
   }
 
   private class ArrayBasedHolder implements RawKeyHolder {
-    // TODO: using bitmap might better

Review comment:
       No it’s not a good idea because it creates data dependencies between any contiguous set of 64 groups as they all need to update the same word. I tried it and it was about 30% worse.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #7777:
URL: https://github.com/apache/pinot/pull/7777#discussion_r751725837



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -612,7 +656,8 @@ public void processMultiValue(int numDocs, int[][] outGroupIds) {
     private int getGroupId(long rawKey) {
       int numGroups = _groupIdMap.size();
       if (numGroups < _globalGroupIdUpperBound) {
-        return _groupIdMap.computeIfAbsent(rawKey, k -> numGroups);
+        int id = _groupIdMap.putIfAbsent(rawKey, numGroups);
+        return id == _groupIdMap.defaultReturnValue() ? numGroups : id;

Review comment:
       Might be slightly faster to do
   ```suggestion
           return id == INVALID_ID ? numGroups : id;
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -587,6 +617,20 @@ public LongMapBasedHolder(Long2IntOpenHashMap groupIdMap) {
 
     @Override
     public void processSingleValue(int numDocs, int[] outGroupIds) {
+      if (_numGroupByExpressions == 1) {

Review comment:
       We should never get into `LongMapBasedHolder` for single group-by expression

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -253,12 +252,29 @@ public int getNumKeys() {
   }
 
   private class ArrayBasedHolder implements RawKeyHolder {
-    // TODO: using bitmap might better

Review comment:
       Should we consider using `BitSet` to replace this boolean array?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang merged pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang merged pull request #7777:
URL: https://github.com/apache/pinot/pull/7777


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] richardstartin commented on a change in pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
richardstartin commented on a change in pull request #7777:
URL: https://github.com/apache/pinot/pull/7777#discussion_r751781564



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java
##########
@@ -612,7 +656,8 @@ public void processMultiValue(int numDocs, int[][] outGroupIds) {
     private int getGroupId(long rawKey) {
       int numGroups = _groupIdMap.size();
       if (numGroups < _globalGroupIdUpperBound) {
-        return _groupIdMap.computeIfAbsent(rawKey, k -> numGroups);
+        int id = _groupIdMap.putIfAbsent(rawKey, numGroups);
+        return id == _groupIdMap.defaultReturnValue() ? numGroups : id;

Review comment:
       Maybe, the intent here was just to remove the capturing lambda while I was looking at something nearby. There’s no justification for this change, except to eliminate an allocation.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] richardstartin commented on pull request #7777: peel off special case for 1 dimensional groupby

Posted by GitBox <gi...@apache.org>.
richardstartin commented on pull request #7777:
URL: https://github.com/apache/pinot/pull/7777#issuecomment-972761090


   @Jackie-Jiang addressed your comments


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org