use of org.apache.carbondata.core.scan.filter.executer.IncludeFilterExecutorImpl in project carbondata by apache.
the class FilterUtil method getIncludeFilterExecutor.
/**
* It gives filter executor based on columnar or column group
*
* @param dimColResolvedFilterInfo
* @param segmentProperties
* @return
*/
private static FilterExecutor getIncludeFilterExecutor(DimColumnResolvedFilterInfo dimColResolvedFilterInfo, MeasureColumnResolvedFilterInfo msrColResolvedFilterInfo, SegmentProperties segmentProperties) {
if (null != msrColResolvedFilterInfo && msrColResolvedFilterInfo.getMeasure().isMeasure()) {
CarbonMeasure measuresFromCurrentBlock = segmentProperties.getMeasureFromCurrentBlock(msrColResolvedFilterInfo.getMeasure());
if (null != measuresFromCurrentBlock) {
// update dimension and column index according to the dimension position in current block
MeasureColumnResolvedFilterInfo msrColResolvedFilterInfoCopyObject = msrColResolvedFilterInfo.getCopyObject();
msrColResolvedFilterInfoCopyObject.setMeasure(measuresFromCurrentBlock);
msrColResolvedFilterInfoCopyObject.setColumnIndex(measuresFromCurrentBlock.getOrdinal());
msrColResolvedFilterInfoCopyObject.setType(measuresFromCurrentBlock.getDataType());
return new IncludeFilterExecutorImpl(null, msrColResolvedFilterInfoCopyObject, segmentProperties, true);
} else {
return new RestructureIncludeFilterExecutorImpl(dimColResolvedFilterInfo, msrColResolvedFilterInfo, true);
}
}
CarbonDimension dimension = dimColResolvedFilterInfo.getDimension();
if (dimension.hasEncoding(Encoding.IMPLICIT)) {
return new ImplicitIncludeFilterExecutorImpl(dimColResolvedFilterInfo);
} else {
CarbonDimension dimensionFromCurrentBlock = segmentProperties.getDimensionFromCurrentBlock(dimColResolvedFilterInfo.getDimension());
if (null != dimensionFromCurrentBlock) {
// update dimension and column index according to the dimension position in current block
DimColumnResolvedFilterInfo dimColResolvedFilterInfoCopyObject = dimColResolvedFilterInfo.getCopyObject();
dimColResolvedFilterInfoCopyObject.setDimension(dimensionFromCurrentBlock);
dimColResolvedFilterInfoCopyObject.setColumnIndex(dimensionFromCurrentBlock.getOrdinal());
return new IncludeFilterExecutorImpl(dimColResolvedFilterInfoCopyObject, null, segmentProperties, false);
} else {
return new RestructureIncludeFilterExecutorImpl(dimColResolvedFilterInfo, msrColResolvedFilterInfo, false);
}
}
}
use of org.apache.carbondata.core.scan.filter.executer.IncludeFilterExecutorImpl in project carbondata by apache.
the class FilterUtil method getFilterExecutorForRangeFilters.
/**
* Below method will be used to get filter executor instance for range filters
* when local dictionary is present for in blocklet
* @param rawColumnChunk
* raw column chunk
* @param exp
* filter expression
* @param isNaturalSorted
* is data was already sorted
* @return
*/
public static FilterExecutor getFilterExecutorForRangeFilters(DimensionRawColumnChunk rawColumnChunk, Expression exp, boolean isNaturalSorted) {
BitSet includeDictionaryValues;
try {
includeDictionaryValues = FilterUtil.getIncludeDictFilterValuesForRange(exp, rawColumnChunk.getLocalDictionary());
} catch (FilterUnsupportedException e) {
throw new RuntimeException(e);
}
boolean isExclude = includeDictionaryValues.cardinality() > 1 && FilterUtil.isExcludeFilterNeedsToApply(rawColumnChunk.getLocalDictionary().getDictionaryActualSize(), includeDictionaryValues.cardinality());
byte[][] encodedFilterValues = FilterUtil.getEncodedFilterValuesForRange(includeDictionaryValues, rawColumnChunk.getLocalDictionary(), isExclude);
FilterExecutor filterExecutor;
if (!isExclude) {
filterExecutor = new IncludeFilterExecutorImpl(encodedFilterValues, isNaturalSorted);
} else {
filterExecutor = new ExcludeFilterExecutorImpl(encodedFilterValues, isNaturalSorted);
}
return filterExecutor;
}
Aggregations