minor,change Dictionary<?> to Dictionary<String> in DictionaryManager and DictionaryInfo
Signed-off-by: Li Yang <liy...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/be11dc62 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/be11dc62 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/be11dc62 Branch: refs/heads/master-cdh5.7 Commit: be11dc629460ef4620300e1508c548037540f961 Parents: 5f6450d Author: xiefan46 <958034...@qq.com> Authored: Tue Jan 10 16:33:25 2017 +0800 Committer: Li Yang <liy...@apache.org> Committed: Wed Jan 11 13:04:36 2017 +0800 ---------------------------------------------------------------------- .../java/org/apache/kylin/dict/DictionaryInfo.java | 6 +++--- .../apache/kylin/dict/DictionaryInfoSerializer.java | 4 ++-- .../java/org/apache/kylin/dict/DictionaryManager.java | 14 +++++++------- .../kylin/engine/mr/steps/MergeCuboidMapperTest.java | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/be11dc62/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java ---------------------------------------------------------------------- diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java index 8526467..a85628d 100644 --- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java +++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfo.java @@ -47,7 +47,7 @@ public class DictionaryInfo extends RootPersistentEntity { @JsonProperty("cardinality") private int cardinality; - transient Dictionary<?> dictionaryObject; + transient Dictionary<String> dictionaryObject; public DictionaryInfo() { } @@ -144,11 +144,11 @@ public class DictionaryInfo extends RootPersistentEntity { this.dictionaryClass = dictionaryClass; } - public Dictionary<?> getDictionaryObject() { + public Dictionary<String> getDictionaryObject() { return dictionaryObject; } - public void setDictionaryObject(Dictionary<?> dictionaryObject) { + public void setDictionaryObject(Dictionary<String> dictionaryObject) { this.dictionaryObject = dictionaryObject; } http://git-wip-us.apache.org/repos/asf/kylin/blob/be11dc62/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfoSerializer.java ---------------------------------------------------------------------- diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfoSerializer.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfoSerializer.java index 04eedbe..ee88ea7 100644 --- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfoSerializer.java +++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryInfoSerializer.java @@ -61,9 +61,9 @@ public class DictionaryInfoSerializer implements Serializer<DictionaryInfo> { DictionaryInfo obj = JsonUtil.readValue(json, DictionaryInfo.class); if (infoOnly == false) { - Dictionary<?> dict; + Dictionary<String> dict; try { - dict = (Dictionary<?>) ClassUtil.forName(obj.getDictionaryClass(), Dictionary.class).newInstance(); + dict = (Dictionary<String>) ClassUtil.forName(obj.getDictionaryClass(), Dictionary.class).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { http://git-wip-us.apache.org/repos/asf/kylin/blob/be11dc62/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java ---------------------------------------------------------------------- diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java index 54bc1c4..3ba24cf 100644 --- a/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java +++ b/core-dictionary/src/main/java/org/apache/kylin/dict/DictionaryManager.java @@ -108,7 +108,7 @@ public class DictionaryManager { }); } - public Dictionary<?> getDictionary(String resourcePath) throws IOException { + public Dictionary<String> getDictionary(String resourcePath) throws IOException { DictionaryInfo dictInfo = getDictionaryInfo(resourcePath); return dictInfo == null ? null : dictInfo.getDictionaryObject(); } @@ -130,7 +130,7 @@ public class DictionaryManager { * Save the dictionary as it is. * More often you should consider using its alternative trySaveNewDict to save dict space */ - public DictionaryInfo forceSave(Dictionary<?> newDict, DictionaryInfo newDictInfo) throws IOException { + public DictionaryInfo forceSave(Dictionary<String> newDict, DictionaryInfo newDictInfo) throws IOException { initDictInfo(newDict, newDictInfo); logger.info("force to save dict directly"); return saveNewDict(newDictInfo); @@ -140,7 +140,7 @@ public class DictionaryManager { * @return may return another dict that is a super set of the input * @throws IOException */ - public DictionaryInfo trySaveNewDict(Dictionary<?> newDict, DictionaryInfo newDictInfo) throws IOException { + public DictionaryInfo trySaveNewDict(Dictionary<String> newDict, DictionaryInfo newDictInfo) throws IOException { initDictInfo(newDict, newDictInfo); @@ -149,7 +149,7 @@ public class DictionaryManager { DictionaryInfo largestDictInfo = findLargestDictInfo(newDictInfo); if (largestDictInfo != null) { largestDictInfo = getDictionaryInfo(largestDictInfo.getResourcePath()); - Dictionary<?> largestDictObject = largestDictInfo.getDictionaryObject(); + Dictionary<String> largestDictObject = largestDictInfo.getDictionaryObject(); if (largestDictObject.contains(newDict)) { logger.info("dictionary content " + newDict + ", is contained by dictionary at " + largestDictInfo.getResourcePath()); return largestDictInfo; @@ -175,7 +175,7 @@ public class DictionaryManager { } } - private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<?> dict) throws IOException { + private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<String> dict) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); NavigableSet<String> existings = store.listResources(dictInfo.getResourceDir()); if (existings == null) @@ -196,7 +196,7 @@ public class DictionaryManager { return null; } - private void initDictInfo(Dictionary<?> newDict, DictionaryInfo newDictInfo) { + private void initDictInfo(Dictionary<String> newDict, DictionaryInfo newDictInfo) { newDictInfo.setCardinality(newDict.getSize()); newDictInfo.setDictionaryObject(newDict); newDictInfo.setDictionaryClass(newDict.getClass().getName()); @@ -263,7 +263,7 @@ public class DictionaryManager { logger.info("Use one of the merging dictionaries directly"); return dicts.get(0); } else { - Dictionary<?> newDict = DictionaryGenerator.mergeDictionaries(DataType.getType(newDictInfo.getDataType()), dicts); + Dictionary<String> newDict = DictionaryGenerator.mergeDictionaries(DataType.getType(newDictInfo.getDataType()), dicts); return trySaveNewDict(newDict, newDictInfo); } } http://git-wip-us.apache.org/repos/asf/kylin/blob/be11dc62/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java ---------------------------------------------------------------------- diff --git a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java index 075ec80..dc593b0 100644 --- a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java +++ b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java @@ -75,7 +75,7 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase { List<String> values = new ArrayList<>(); values.add("eee"); values.add("fff"); - Dictionary<?> dict = DictionaryGenerator.buildDictionary(DataType.getType(newDictInfo.getDataType()), new IterableDictionaryValueEnumerator(values)); + Dictionary<String> dict = DictionaryGenerator.buildDictionary(DataType.getType(newDictInfo.getDataType()), new IterableDictionaryValueEnumerator(values)); dictionaryManager.trySaveNewDict(dict, newDictInfo); dict.dump(System.out); @@ -127,7 +127,7 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase { values.add("ccc"); else values.add("bbb"); - Dictionary<?> dict = DictionaryGenerator.buildDictionary(DataType.getType(newDictInfo.getDataType()), new IterableDictionaryValueEnumerator(values)); + Dictionary<String> dict = DictionaryGenerator.buildDictionary(DataType.getType(newDictInfo.getDataType()), new IterableDictionaryValueEnumerator(values)); dictionaryManager.trySaveNewDict(dict, newDictInfo); dict.dump(System.out); @@ -161,7 +161,7 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase { CubeSegment newSeg = cubeManager.mergeSegments(cube, 0L, Long.MAX_VALUE, 0, 0, false); // String segmentName = newSeg.getName(); - final Dictionary<?> dictionary = cubeManager.getDictionary(newSeg, lfn); + final Dictionary<String> dictionary = cubeManager.getDictionary(newSeg, lfn); assertTrue(dictionary == null); // ((TrieDictionary) dictionary).dump(System.out);