You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ga...@apache.org on 2016/12/09 11:36:19 UTC
kylin git commit: MTHDP-984 AppendTrieDictionary refine equals
hashCode toString
Repository: kylin
Updated Branches:
refs/heads/master 9e8d13482 -> a006c9824
MTHDP-984 AppendTrieDictionary refine equals hashCode toString
Signed-off-by: gaodayue <ga...@meituan.com>
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/a006c982
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/a006c982
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/a006c982
Branch: refs/heads/master
Commit: a006c98244ec21fbbbba71ed4b63d56059278e1d
Parents: 9e8d134
Author: gaodayue <ga...@meituan.com>
Authored: Tue Dec 6 14:17:32 2016 +0800
Committer: gaodayue <ga...@meituan.com>
Committed: Fri Dec 9 19:33:35 2016 +0800
----------------------------------------------------------------------
.../apache/kylin/dict/AppendTrieDictionary.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/a006c982/core-dictionary/src/main/java/org/apache/kylin/dict/AppendTrieDictionary.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/AppendTrieDictionary.java b/core-dictionary/src/main/java/org/apache/kylin/dict/AppendTrieDictionary.java
index 84060a7..35aa9a5 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/AppendTrieDictionary.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/AppendTrieDictionary.java
@@ -36,6 +36,7 @@ import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.NavigableSet;
+import java.util.Objects;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
@@ -891,7 +892,7 @@ public class AppendTrieDictionary<T> extends Dictionary<T> {
logger.info("GlobalDict {} is empty, create new one", resourcePath);
builder = new Builder<>(resourcePath, null, dictDir, 0, 0, 0, new StringBytesConverter(), null);
} else {
- logger.info("GlobalDict {} exist, append value", dictToUse);
+ logger.info("GlobalDict {} exist, append value", resourcePath);
builder = new Builder<>(resourcePath, dictToUse, dictToUse.baseDir, dictToUse.maxId, dictToUse.maxValueLength,
dictToUse.nValues, dictToUse.bytesConverter, dictToUse.writeDictMap());
}
@@ -1264,11 +1265,7 @@ public class AppendTrieDictionary<T> extends Dictionary<T> {
@Override
public int hashCode() {
- int hashCode = 31;
- for (DictSlice slice : dictSliceMap.values()) {
- hashCode += 31 * slice.hashCode();
- }
- return hashCode;
+ return Objects.hashCode(baseDir);
}
@Override
@@ -1276,10 +1273,19 @@ public class AppendTrieDictionary<T> extends Dictionary<T> {
if (this == o) {
return true;
}
+ if (o instanceof AppendTrieDictionary) {
+ AppendTrieDictionary that = (AppendTrieDictionary) o;
+ return Objects.equals(this.baseDir, that.baseDir);
+ }
return false;
}
@Override
+ public String toString() {
+ return String.format("AppendTrieDictionary(%s)", baseDir);
+ }
+
+ @Override
public boolean contains(Dictionary other) {
return false;
}