asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Westmann (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Fix ASTERIXDB-1255
Date Fri, 16 Dec 2016 22:59:34 GMT
Till Westmann has submitted this change and it was merged.

Change subject: Fix ASTERIXDB-1255
......................................................................


Fix ASTERIXDB-1255

This changes enable dynamic hashtable size in SimilarityJaccardEvaluator

Change-Id: I08c550d35d864df08792369d38ff81012e3976af
Reviewed-on: https://asterix-gerrit.ics.uci.edu/586
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
---
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
1 file changed, 10 insertions(+), 4 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; Verified

Objections:
  Jenkins: Violations found



diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
index e9928a1..ab817bd 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
@@ -50,11 +50,11 @@
 public class SimilarityJaccardEvaluator implements IScalarEvaluator {
 
     // Parameters for hash table.
-    protected final int TABLE_SIZE = 100;
-    protected final int TABLE_FRAME_SIZE = 32768;
+    protected static final int MIN_TABLE_SIZE = 100;
+    protected static final int TABLE_FRAME_SIZE = 32768;
 
     // Assuming type indicator in serde format.
-    protected final int TYPE_INDICATOR_SIZE = 1;
+    protected static final int TYPE_INDICATOR_SIZE = 1;
 
     protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
     protected final DataOutput out = resultStorage.getDataOutput();
@@ -88,6 +88,8 @@
 
     // Ignore case for strings. Defaults to true.
     protected final boolean ignoreCase = true;
+
+    protected int hashTableSize = MIN_TABLE_SIZE;
 
     public SimilarityJaccardEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext
context)
             throws HyracksDataException {
@@ -140,6 +142,10 @@
         if (firstListIter.size() == 0 || secondListIter.size() == 0) {
             return false;
         }
+
+        // Set the size of the table dynamically
+        hashTableSize = Math.max(Math.max(firstListIter.size(), secondListIter.size()), MIN_TABLE_SIZE);
+
         // TODO: Check item types are compatible.
         return true;
     }
@@ -229,7 +235,7 @@
                 .createBinaryHashFunction(probeItemTypeTag, ignoreCase);
         IBinaryComparator cmp = ListItemBinaryComparatorFactory.INSTANCE.createBinaryComparator(buildItemTypeTag,
                 probeItemTypeTag, ignoreCase);
-        hashMap = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, putHashFunc, getHashFunc,
cmp);
+        hashMap = new BinaryHashMap(hashTableSize, TABLE_FRAME_SIZE, putHashFunc, getHashFunc,
cmp);
     }
 
     protected boolean checkArgTypes(ATypeTag typeTag1, ATypeTag typeTag2) throws HyracksDataException
{

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/586
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08c550d35d864df08792369d38ff81012e3976af
Gerrit-PatchSet: 9
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Heri Ramampiaro <heriram@gmail.com>
Gerrit-Reviewer: Chen Li <chenli@gmail.com>
Gerrit-Reviewer: Heri Ramampiaro <heriram@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message