Search in sources :

Example 6 with SingleTableProvider

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

CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)6 SingleTableProvider (org.apache.carbondata.core.scan.filter.SingleTableProvider)6 TableProvider (org.apache.carbondata.core.scan.filter.TableProvider)6 Expression (org.apache.carbondata.core.scan.expression.Expression)5 FilterResolverIntf (org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf)5 ArrayList (java.util.ArrayList)4 IOException (java.io.IOException)3 Segment (org.apache.carbondata.core.datamap.Segment)3 AbsoluteTableIdentifier (org.apache.carbondata.core.metadata.AbsoluteTableIdentifier)3 UpdateVO (org.apache.carbondata.core.mutate.UpdateVO)3 CarbonInputSplit (org.apache.carbondata.hadoop.CarbonInputSplit)3 InputSplit (org.apache.hadoop.mapreduce.InputSplit)3 BitSet (java.util.BitSet)2 PartitionInfo (org.apache.carbondata.core.metadata.schema.PartitionInfo)2 QueryModel (org.apache.carbondata.core.scan.model.QueryModel)2 SegmentUpdateStatusManager (org.apache.carbondata.core.statusmanager.SegmentUpdateStatusManager)2 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 CacheProvider (org.apache.carbondata.core.cache.CacheProvider)1 BlockIndexStore (org.apache.carbondata.core.datastore.BlockIndexStore)1