public static Dictionary mergeDictionaries(DictionaryInfo targetInfo, List<DictionaryInfo> sourceDicts) { HashSet<byte[]> dedup = new HashSet<byte[]>(); for (DictionaryInfo info : sourceDicts) { Dictionary<?> dict = info.getDictionaryObject(); int minkey = dict.getMinId(); int maxkey = dict.getMaxId(); byte[] buffer = new byte[dict.getSizeOfValue()]; for (int i = minkey; i <= maxkey; ++i) { int size = dict.getValueBytesFromId(i, buffer, 0); dedup.add(Bytes.copy(buffer, 0, size)); } } List<byte[]> valueList = new ArrayList<byte[]>(); valueList.addAll(dedup); return buildDictionaryFromValueList(targetInfo, valueList); }
int idInMergedDict; int size = sourceDict.getValueBytesFromId(idInSourceDict, newKeyBuf, bufOffset); if (size < 0) { idInMergedDict = mergedDict.nullId();