This is an automated email from the ASF dual-hosted git repository.

siddteotia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new af742f7  do not use Arrays.hashCode in ExpressionContext or 
FunctionContext because this leads to high allocationr rate (#8124)
af742f7 is described below

commit af742f7d7e1dbe4325c982f3a0164927d8a0037f
Author: Richard Startin <[email protected]>
AuthorDate: Fri Feb 4 20:43:30 2022 +0000

    do not use Arrays.hashCode in ExpressionContext or FunctionContext because 
this leads to high allocationr rate (#8124)
---
 .../org/apache/pinot/common/request/context/ExpressionContext.java  | 6 +++++-
 .../org/apache/pinot/common/request/context/FunctionContext.java    | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java
index 35f87ab..141c396 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java
@@ -99,7 +99,11 @@ public class ExpressionContext {
 
   @Override
   public int hashCode() {
-    return Objects.hash(_type, _value, _function);
+    int hash = 31 * 31 * _type.hashCode();
+    if (_type == Type.FUNCTION) {
+      return hash + _function.hashCode();
+    }
+    return hash + 31 * _value.hashCode();
   }
 
   @Override
diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/request/context/FunctionContext.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/request/context/FunctionContext.java
index 066c315..05ade05 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/request/context/FunctionContext.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/request/context/FunctionContext.java
@@ -84,7 +84,7 @@ public class FunctionContext {
 
   @Override
   public int hashCode() {
-    return Objects.hash(_type, _functionName, _arguments);
+    return 31 * 31 * _type.hashCode() + 31 * _functionName.hashCode() + 
_arguments.hashCode();
   }
 
   @Override

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to