Search in sources :

Example 1 with BinaryLogicalExpression

use of org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression in project carbondata by apache.

the class RowLevelRangeFilterResolverImpl method resolve.

/**
   * Method which will resolve the filter expression by converting the filter
   * member to its assigned dictionary values.
   */
public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier) throws FilterUnsupportedException {
    DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = null;
    MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = null;
    int index = 0;
    if (exp instanceof BinaryLogicalExpression) {
        BinaryLogicalExpression conditionalExpression = (BinaryLogicalExpression) exp;
        List<ColumnExpression> columnList = conditionalExpression.getColumnList();
        for (ColumnExpression columnExpression : columnList) {
            if (columnExpression.isDimension()) {
                dimColumnEvaluatorInfo = new DimColumnResolvedFilterInfo();
                DimColumnFilterInfo filterInfo = new DimColumnFilterInfo();
                dimColumnEvaluatorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                dimColumnEvaluatorInfo.setRowIndex(index++);
                dimColumnEvaluatorInfo.setDimension(columnExpression.getDimension());
                dimColumnEvaluatorInfo.setDimensionExistsInCurrentSilce(false);
                if (columnExpression.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
                    filterInfo.setFilterList(getDirectSurrogateValues(columnExpression));
                } else {
                    filterInfo.setFilterListForNoDictionaryCols(getNoDictionaryRangeValues());
                }
                filterInfo.setIncludeFilter(isIncludeFilter);
                dimColumnEvaluatorInfo.setFilterValues(filterInfo);
                dimColumnEvaluatorInfo.addDimensionResolvedFilterInstance(columnExpression.getDimension(), filterInfo);
                dimColEvaluatorInfoList.add(dimColumnEvaluatorInfo);
            } else {
                msrColumnEvalutorInfo = new MeasureColumnResolvedFilterInfo();
                msrColumnEvalutorInfo.setRowIndex(index++);
                msrColumnEvalutorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                msrColumnEvalutorInfo.setType(columnExpression.getCarbonColumn().getDataType());
                msrColEvalutorInfoList.add(msrColumnEvalutorInfo);
            }
        }
    }
}
Also used : MeasureColumnResolvedFilterInfo(org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo) DimColumnResolvedFilterInfo(org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo) BinaryLogicalExpression(org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression) DimColumnFilterInfo(org.apache.carbondata.core.scan.filter.DimColumnFilterInfo) ColumnExpression(org.apache.carbondata.core.scan.expression.ColumnExpression)

Example 2 with BinaryLogicalExpression

use of org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression in project carbondata by apache.

the class RowLevelRangeFilterResolverImpl method resolve.

/**
 * Method which will resolve the filter expression by converting the filter
 * member to its assigned dictionary values.
 */
public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier, TableProvider tableProvider) throws FilterUnsupportedException {
    DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = null;
    MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = null;
    int index = 0;
    if (exp instanceof BinaryLogicalExpression) {
        BinaryLogicalExpression conditionalExpression = (BinaryLogicalExpression) exp;
        List<ColumnExpression> columnList = conditionalExpression.getColumnList();
        for (ColumnExpression columnExpression : columnList) {
            if (columnExpression.isDimension()) {
                dimColumnEvaluatorInfo = new DimColumnResolvedFilterInfo();
                ColumnFilterInfo filterInfo = new ColumnFilterInfo();
                dimColumnEvaluatorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                dimColumnEvaluatorInfo.setRowIndex(index++);
                dimColumnEvaluatorInfo.setDimension(columnExpression.getDimension());
                dimColumnEvaluatorInfo.setDimensionExistsInCurrentSilce(false);
                if (columnExpression.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
                    if (!isIncludeFilter) {
                        filterInfo.setExcludeFilterList(getDirectSurrogateValues(columnExpression));
                    } else {
                        filterInfo.setFilterList(getDirectSurrogateValues(columnExpression));
                    }
                } else {
                    filterInfo.setFilterListForNoDictionaryCols(getNoDictionaryRangeValues());
                }
                filterInfo.setIncludeFilter(isIncludeFilter);
                dimColumnEvaluatorInfo.setFilterValues(filterInfo);
                dimColumnEvaluatorInfo.addDimensionResolvedFilterInstance(columnExpression.getDimension(), filterInfo);
                dimColEvaluatorInfoList.add(dimColumnEvaluatorInfo);
            } else {
                msrColumnEvalutorInfo = new MeasureColumnResolvedFilterInfo();
                ColumnFilterInfo filterInfo = new ColumnFilterInfo();
                msrColumnEvalutorInfo.setMeasure(columnExpression.getMeasure());
                msrColumnEvalutorInfo.setRowIndex(index++);
                msrColumnEvalutorInfo.setCarbonColumn(columnExpression.getCarbonColumn());
                msrColumnEvalutorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                msrColumnEvalutorInfo.setType(columnExpression.getCarbonColumn().getDataType());
                msrColumnEvalutorInfo.setMeasureExistsInCurrentSilce(false);
                filterInfo.setMeasuresFilterValuesList(getMeasureRangeValues(columnExpression.getMeasure()));
                filterInfo.setIncludeFilter(isIncludeFilter);
                msrColumnEvalutorInfo.setFilterValues(filterInfo);
                msrColumnEvalutorInfo.addMeasureResolvedFilterInstance(columnExpression.getMeasure(), filterInfo);
                msrColEvalutorInfoList.add(msrColumnEvalutorInfo);
            }
        }
    }
}
Also used : MeasureColumnResolvedFilterInfo(org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo) DimColumnResolvedFilterInfo(org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo) BinaryLogicalExpression(org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression) ColumnExpression(org.apache.carbondata.core.scan.expression.ColumnExpression) ColumnFilterInfo(org.apache.carbondata.core.scan.filter.ColumnFilterInfo)

Aggregations

ColumnExpression (org.apache.carbondata.core.scan.expression.ColumnExpression)2 BinaryLogicalExpression (org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression)2 DimColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo)2 MeasureColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo)2 ColumnFilterInfo (org.apache.carbondata.core.scan.filter.ColumnFilterInfo)1 DimColumnFilterInfo (org.apache.carbondata.core.scan.filter.DimColumnFilterInfo)1