Search in sources :

Example 11 with MeasureColumnResolvedFilterInfo

use of org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo in project carbondata by apache.

the class RowLevelFilterResolverImpl 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) {
    DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = null;
    MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = null;
    int index = 0;
    if (exp instanceof ConditionalExpression) {
        ConditionalExpression conditionalExpression = (ConditionalExpression) exp;
        List<ColumnExpression> columnList = conditionalExpression.getColumnList();
        for (ColumnExpression columnExpression : columnList) {
            if (columnExpression.isDimension()) {
                dimColumnEvaluatorInfo = new DimColumnResolvedFilterInfo();
                dimColumnEvaluatorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                dimColumnEvaluatorInfo.setRowIndex(index++);
                dimColumnEvaluatorInfo.setDimension(columnExpression.getDimension());
                dimColumnEvaluatorInfo.setDimensionExistsInCurrentSilce(false);
                dimColEvaluatorInfoList.add(dimColumnEvaluatorInfo);
            } else {
                msrColumnEvalutorInfo = new MeasureColumnResolvedFilterInfo();
                msrColumnEvalutorInfo.setCarbonColumn(columnExpression.getCarbonColumn());
                msrColumnEvalutorInfo.setRowIndex(index++);
                msrColumnEvalutorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
                msrColumnEvalutorInfo.setMeasure(columnExpression.getMeasure());
                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) ColumnExpression(org.apache.carbondata.core.scan.expression.ColumnExpression) ConditionalExpression(org.apache.carbondata.core.scan.expression.conditional.ConditionalExpression)

Example 12 with MeasureColumnResolvedFilterInfo

use of org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo 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

MeasureColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo)12 DimColumnResolvedFilterInfo (org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo)11 ColumnExpression (org.apache.carbondata.core.scan.expression.ColumnExpression)4 GenericQueryType (org.apache.carbondata.core.scan.filter.GenericQueryType)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataOutputStream (java.io.DataOutputStream)2 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 DataType (org.apache.carbondata.core.metadata.datatype.DataType)2 CarbonDimension (org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension)2 CarbonMeasure (org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure)2 ConditionalExpression (org.apache.carbondata.core.scan.expression.conditional.ConditionalExpression)2 BinaryLogicalExpression (org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression)2 ColumnFilterInfo (org.apache.carbondata.core.scan.filter.ColumnFilterInfo)2 ArrayList (java.util.ArrayList)1 DimensionColumnDataChunk (org.apache.carbondata.core.datastore.chunk.DimensionColumnDataChunk)1 DimensionColumnPage (org.apache.carbondata.core.datastore.chunk.DimensionColumnPage)1 MeasureColumnDataChunk (org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk)1 VariableLengthDimensionColumnPage (org.apache.carbondata.core.datastore.chunk.impl.VariableLengthDimensionColumnPage)1 VariableLengthDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.VariableLengthDimensionDataChunk)1