DictionaryPage page = dictionaries.readDictionaryPage(col);
@SuppressWarnings("unchecked") private <T extends Comparable<T>> Set<T> expandDictionary(ColumnChunkMetaData meta) throws IOException { ColumnDescriptor col = new ColumnDescriptor(meta.getPath().toArray(), meta.getPrimitiveType(), -1, -1); DictionaryPage page = dictionaries.readDictionaryPage(col); // the chunk may not be dictionary-encoded if (page == null) { return null; } Dictionary dict = page.getEncoding().initDictionary(col, page); Set dictSet = new HashSet<T>(); for (int i=0; i<=dict.getMaxId(); i++) { switch(meta.getType()) { case BINARY: dictSet.add(dict.decodeToBinary(i)); break; case INT32: dictSet.add(dict.decodeToInt(i)); break; case INT64: dictSet.add(dict.decodeToLong(i)); break; case FLOAT: dictSet.add(dict.decodeToFloat(i)); break; case DOUBLE: dictSet.add(dict.decodeToDouble(i)); break; default: LOG.warn("Unknown dictionary type{}", meta.getType()); } } return (Set<T>) dictSet; }
@SuppressWarnings("unchecked") private <T extends Comparable<T>> Set<T> expandDictionary(ColumnChunkMetaData meta) throws IOException { ColumnDescriptor col = new ColumnDescriptor(meta.getPath().toArray(), meta.getPrimitiveType(), -1, -1); DictionaryPage page = dictionaries.readDictionaryPage(col);