use of org.apache.carbondata.core.scan.filter.ColumnFilterInfo in project carbondata by apache.
the class CustomTypeDictionaryVisitor method getDirectDictionaryValKeyMemberForFilter.
protected ColumnFilterInfo getDirectDictionaryValKeyMemberForFilter(ColumnExpression columnExpression, List<String> evaluateResultListFinal, boolean isIncludeFilter, DataType dataType) {
List<Integer> surrogates = new ArrayList<Integer>(20);
DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(columnExpression.getDimension().getDataType());
// Reading the dictionary value direct
getSurrogateValuesForDictionary(evaluateResultListFinal, surrogates, directDictionaryGenerator, dataType);
Collections.sort(surrogates);
ColumnFilterInfo columnFilterInfo = null;
if (surrogates.size() > 0) {
columnFilterInfo = new ColumnFilterInfo();
columnFilterInfo.setIncludeFilter(isIncludeFilter);
if (!isIncludeFilter) {
columnFilterInfo.setExcludeFilterList(surrogates);
} else {
columnFilterInfo.setFilterList(surrogates);
}
}
return columnFilterInfo;
}
use of org.apache.carbondata.core.scan.filter.ColumnFilterInfo in project carbondata by apache.
the class ImplicitColumnVisitor method populateFilterResolvedInfo.
/**
* Visitor Method will update the filter related details in visitableObj, For implicit
* type columns the filter members will resolved directly, no need to look up in dictionary
* since it will not be part of dictionary, directly the actual data can be taken
* and can be set. This type of encoding is effective when the particular column
* is having very high cardinality.
*
* @param visitableObj
* @param metadata
* @throws FilterUnsupportedException,if exception occurs while evaluating
* filter models.
*/
@Override
public void populateFilterResolvedInfo(ColumnResolvedFilterInfo visitableObj, FilterResolverMetadata metadata) throws FilterUnsupportedException, IOException {
if (visitableObj instanceof DimColumnResolvedFilterInfo) {
ColumnFilterInfo resolvedFilterObject = null;
List<String> evaluateResultListFinal;
try {
evaluateResultListFinal = metadata.getExpression().evaluate(null).getListAsString();
} catch (FilterIllegalMemberException e) {
throw new FilterUnsupportedException(e);
}
resolvedFilterObject = FilterUtil.getImplicitColumnFilterList(evaluateResultListFinal, metadata.isIncludeFilter());
((DimColumnResolvedFilterInfo) visitableObj).setFilterValues(resolvedFilterObject);
}
}
Aggregations