本文整理汇总了Java中org.apache.kylin.dict.DictionaryManager.trySaveNewDict方法的典型用法代码示例。如果您正苦于以下问题:Java DictionaryManager.trySaveNewDict方法的具体用法?Java DictionaryManager.trySaveNewDict怎么用?Java DictionaryManager.trySaveNewDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.dict.DictionaryManager
的用法示例。
在下文中一共展示了DictionaryManager.trySaveNewDict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeDictionary
import org.apache.kylin.dict.DictionaryManager; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static Map<TblColRef, Dictionary<String>> writeDictionary(CubeSegment cubeSegment, Map<TblColRef, Dictionary<String>> dictionaryMap, long startOffset, long endOffset) {
Map<TblColRef, Dictionary<String>> realDictMap = Maps.newHashMap();
for (Map.Entry<TblColRef, Dictionary<String>> entry : dictionaryMap.entrySet()) {
final TblColRef tblColRef = entry.getKey();
final Dictionary<String> dictionary = entry.getValue();
IReadableTable.TableSignature signature = new IReadableTable.TableSignature();
signature.setLastModifiedTime(System.currentTimeMillis());
signature.setPath(String.format("streaming_%s_%s", startOffset, endOffset));
signature.setSize(endOffset - startOffset);
DictionaryInfo dictInfo = new DictionaryInfo(tblColRef.getColumnDesc(), tblColRef.getDatatype(), signature);
logger.info("writing dictionary for TblColRef:" + tblColRef.toString());
DictionaryManager dictionaryManager = DictionaryManager.getInstance(cubeSegment.getCubeDesc().getConfig());
try {
DictionaryInfo realDict = dictionaryManager.trySaveNewDict(dictionary, dictInfo);
cubeSegment.putDictResPath(tblColRef, realDict.getResourcePath());
realDictMap.put(tblColRef, (Dictionary<String>) realDict.getDictionaryObject());
} catch (IOException e) {
throw new RuntimeException("error save dictionary for column:" + tblColRef, e);
}
}
return realDictMap;
}