Copilot commented on code in PR #16982:
URL: https://github.com/apache/pinot/pull/16982#discussion_r2415189657
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java:
##########
@@ -29,6 +29,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.function.ToIntFunction;
Review Comment:
[nitpick] The ToIntFunction import is only used for a single cast on line
841. Consider using a lambda expression instead or defining a local variable to
avoid this additional import.
```suggestion
```
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DictionaryBasedGroupKeyGenerator.java:
##########
@@ -864,7 +838,7 @@ public void processMultiValue(int numDocs, int[][]
outGroupIds) {
private int getGroupId(IntArray rawKey) {
int numGroups = _groupIdMap.size();
if (numGroups < _globalGroupIdUpperBound) {
- return _groupIdMap.computeIntIfAbsent(rawKey, k -> numGroups);
+ return _groupIdMap.computeIfAbsent(rawKey, (ToIntFunction<? super
IntArray>) k -> numGroups);
Review Comment:
The explicit cast to ToIntFunction is unnecessary and reduces readability.
Use computeIntIfAbsent instead, which is the original method designed for this
purpose.
```suggestion
return _groupIdMap.computeIntIfAbsent(rawKey, k -> numGroups);
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]