Search in sources :

Example 11 with ColumnFilterInfo

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;
}
Also used : ArrayList(java.util.ArrayList) DirectDictionaryGenerator(org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator) ColumnFilterInfo(org.apache.carbondata.core.scan.filter.ColumnFilterInfo)

Example 12 with 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);
    }
}
Also used : DimColumnResolvedFilterInfo(org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo) ColumnFilterInfo(org.apache.carbondata.core.scan.filter.ColumnFilterInfo) FilterUnsupportedException(org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException) FilterIllegalMemberException(org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException)

Aggregations

ColumnFilterInfo (org.apache.carbondata.core.scan.filter.ColumnFilterInfo)12 DimColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo)8 FilterIllegalMemberException (org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException)7 FilterUnsupportedException (org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException)7 ArrayList (java.util.ArrayList)5 ExpressionResult (org.apache.carbondata.core.scan.expression.ExpressionResult)2 EqualToExpression (org.apache.carbondata.core.scan.expression.conditional.EqualToExpression)2 MeasureColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo)2 DirectDictionaryGenerator (org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator)1 CarbonDimension (org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension)1 CarbonMeasure (org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure)1 QueryExecutionException (org.apache.carbondata.core.scan.executor.exception.QueryExecutionException)1 ColumnExpression (org.apache.carbondata.core.scan.expression.ColumnExpression)1 BinaryLogicalExpression (org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression)1 RangeExpression (org.apache.carbondata.core.scan.expression.logical.RangeExpression)1 SerializableComparator (org.apache.carbondata.core.util.comparator.SerializableComparator)1