/** * return null if no dictionary for given column */ public Dictionary<?> getDictionary(IISegment iiSeg, TblColRef col) { DictionaryInfo info = null; try { DictionaryManager dictMgr = getDictionaryManager(); // logger.info("Using metadata url " + metadataUrl + // " for DictionaryManager"); String dictResPath = iiSeg.getDictResPath(col); if (dictResPath == null) return null; info = dictMgr.getDictionaryInfo(dictResPath); if (info == null) throw new IllegalStateException("No dictionary found by " + dictResPath + ", invalid II state; II segment" + iiSeg + ", col " + col); } catch (IOException e) { throw new IllegalStateException("Failed to get dictionary for II segment" + iiSeg + ", col" + col, e); } return info.getDictionaryObject(); }
public TableRecordInfo(IISegment iiSegment) { seg = iiSegment; desc = seg.getIIInstance().getDescriptor(); allColumns = desc.listAllColumns(); nColumns = allColumns.size(); dictionaries = new Dictionary<?>[nColumns]; measureSerializers = new FixedLenMeasureCodec<?>[nColumns]; DictionaryManager dictMgr = DictionaryManager.getInstance(desc.getConfig()); int index = 0; for (TblColRef tblColRef : desc.listAllColumns()) { ColumnDesc col = tblColRef.getColumn(); if (desc.isMetricsCol(index)) { measureSerializers[index] = FixedLenMeasureCodec.get(col.getType()); } else { String dictPath = seg.getDictResPath(tblColRef); try { dictionaries[index] = dictMgr.getDictionary(dictPath); } catch (IOException e) { throw new RuntimeException("dictionary " + dictPath + " does not exist ", e); } } index++; } digest = createDigest(); }