Search in sources :

Example 1 with DataTypeConverterImpl

use of org.apache.carbondata.core.util.DataTypeConverterImpl in project carbondata by apache.

the class FilterUtil method prepareKeysFromSurrogates.

/**
 * API will prepare the Keys from the surrogates of particular filter resolver
 *
 * @param filterValues
 * @param segmentProperties
 * @param dimension
 * @param dimColumnExecuterInfo
 */
public static void prepareKeysFromSurrogates(ColumnFilterInfo filterValues, SegmentProperties segmentProperties, CarbonDimension dimension, DimColumnExecuterFilterInfo dimColumnExecuterInfo, CarbonMeasure measures, MeasureColumnExecuterFilterInfo msrColumnExecuterInfo) {
    if (null != measures) {
        DataTypeConverterImpl converter = new DataTypeConverterImpl();
        Object[] keysBasedOnFilter = filterValues.getMeasuresFilterValuesList().toArray((new Object[filterValues.getMeasuresFilterValuesList().size()]));
        for (int i = 0; i < keysBasedOnFilter.length; i++) {
            if (keysBasedOnFilter[i] != null) {
                keysBasedOnFilter[i] = DataTypeUtil.getDataBasedOnDataType(keysBasedOnFilter[i].toString(), measures.getDataType(), converter);
            }
        }
        msrColumnExecuterInfo.setFilterKeys(keysBasedOnFilter);
    } else {
        if (filterValues == null) {
            dimColumnExecuterInfo.setFilterKeys(new byte[0][]);
        } else {
            byte[][] keysBasedOnFilter = getKeyArray(filterValues, dimension, segmentProperties, false);
            if (!filterValues.isIncludeFilter() || filterValues.isOptimized()) {
                dimColumnExecuterInfo.setExcludeFilterKeys(getKeyArray(filterValues, dimension, segmentProperties, true));
            }
            dimColumnExecuterInfo.setFilterKeys(keysBasedOnFilter);
        }
    }
}
Also used : DataTypeConverterImpl(org.apache.carbondata.core.util.DataTypeConverterImpl)

Example 2 with DataTypeConverterImpl

use of org.apache.carbondata.core.util.DataTypeConverterImpl in project carbondata by apache.

the class MapredCarbonInputFormat method getQueryModel.

private QueryModel getQueryModel(Configuration configuration, String path) throws IOException, InvalidConfigurationException {
    CarbonTable carbonTable = getCarbonTable(configuration, path);
    TableProvider tableProvider = new SingleTableProvider(carbonTable);
    // getting the table absoluteTableIdentifier from the carbonTable
    // to avoid unnecessary deserialization
    AbsoluteTableIdentifier identifier = carbonTable.getAbsoluteTableIdentifier();
    String projectionString = getProjection(configuration, carbonTable, identifier.getCarbonTableIdentifier().getTableName());
    String[] projectionColumns = projectionString.split(",");
    QueryModel queryModel = carbonTable.createQueryWithProjection(projectionColumns, new DataTypeConverterImpl());
    // set the filter to the query model in order to filter blocklet before scan
    Expression filter = getFilterPredicates(configuration);
    carbonTable.processFilterExpression(filter, null, null);
    FilterResolverIntf filterIntf = carbonTable.resolveFilter(filter, tableProvider);
    queryModel.setFilterExpressionResolverTree(filterIntf);
    return queryModel;
}
Also used : CarbonTable(org.apache.carbondata.core.metadata.schema.table.CarbonTable) SingleTableProvider(org.apache.carbondata.core.scan.filter.SingleTableProvider) AbsoluteTableIdentifier(org.apache.carbondata.core.metadata.AbsoluteTableIdentifier) Expression(org.apache.carbondata.core.scan.expression.Expression) SingleTableProvider(org.apache.carbondata.core.scan.filter.SingleTableProvider) TableProvider(org.apache.carbondata.core.scan.filter.TableProvider) DataTypeConverterImpl(org.apache.carbondata.core.util.DataTypeConverterImpl) QueryModel(org.apache.carbondata.core.scan.model.QueryModel) FilterResolverIntf(org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf)

Aggregations

DataTypeConverterImpl (org.apache.carbondata.core.util.DataTypeConverterImpl)2 AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)1 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)1 Expression (org.apache.carbondata.core.scan.expression.Expression)1 SingleTableProvider (org.apache.carbondata.core.scan.filter.SingleTableProvider)1 TableProvider (org.apache.carbondata.core.scan.filter.TableProvider)1 FilterResolverIntf (org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf)1 QueryModel (org.apache.carbondata.core.scan.model.QueryModel)1