use of org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier in project carbondata by apache.
the class CarbonDictionaryReaderImplTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
columnIdentifier = new ColumnIdentifier("1", null, null);
absoluteTableIdentifier = AbsoluteTableIdentifier.from("tablePath", new CarbonTableIdentifier("dbName", "tableName", UUID.randomUUID().toString()));
DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier = new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier, columnIdentifier.getDataType());
carbonDictionaryReaderImpl = new CarbonDictionaryReaderImpl(dictionaryColumnUniqueIdentifier);
}
use of org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier in project carbondata by apache.
the class QueryUtil method getDictionaryMap.
/**
* Below method will be used to get the column id to its dictionary mapping
*
* @param dictionaryColumnIdList dictionary column list
* @param absoluteTableIdentifier absolute table identifier
* @return dictionary mapping
* @throws IOException
*/
private static Map<String, Dictionary> getDictionaryMap(List<String> dictionaryColumnIdList, AbsoluteTableIdentifier absoluteTableIdentifier, TableProvider tableProvider) throws IOException {
// if any complex dimension not present in query then return the empty map
if (dictionaryColumnIdList.size() == 0) {
return new HashMap<>();
}
// this for dictionary unique identifier
List<DictionaryColumnUniqueIdentifier> dictionaryColumnUniqueIdentifiers = getDictionaryColumnUniqueIdentifierList(dictionaryColumnIdList, absoluteTableIdentifier.getCarbonTableIdentifier(), tableProvider);
CacheProvider cacheProvider = CacheProvider.getInstance();
Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider.createCache(CacheType.FORWARD_DICTIONARY);
List<Dictionary> columnDictionaryList = forwardDictionaryCache.getAll(dictionaryColumnUniqueIdentifiers);
Map<String, Dictionary> columnDictionaryMap = new HashMap<>(columnDictionaryList.size());
for (int i = 0; i < dictionaryColumnUniqueIdentifiers.size(); i++) {
// TODO: null check for column dictionary, if cache size is less it
// might return null here, in that case throw exception
columnDictionaryMap.put(dictionaryColumnUniqueIdentifiers.get(i).getColumnIdentifier().getColumnId(), columnDictionaryList.get(i));
}
return columnDictionaryMap;
}
Aggregations