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);
}
}
}
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;
}
Aggregations