use of org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure in project carbondata by apache.
the class RowLevelFilterExecuterImpl method initMeasureChunkIndexes.
/**
* This method will initialize the measure info for the current block to be
* used for filtering the data
*/
private void initMeasureChunkIndexes() {
for (int i = 0; i < msrColEvalutorInfoList.size(); i++) {
// find the measure in the current block measures list
CarbonMeasure measureFromCurrentBlock = segmentProperties.getMeasureFromCurrentBlock(msrColEvalutorInfoList.get(i).getCarbonColumn().getColumnId());
if (null != measureFromCurrentBlock) {
msrColEvalutorInfoList.get(i).setColumnIndex(measureFromCurrentBlock.getOrdinal());
this.measureChunkIndex[i] = segmentProperties.getMeasuresOrdinalToChunkMapping().get(measureFromCurrentBlock.getOrdinal());
isMeasurePresentInCurrentBlock[i] = true;
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure in project carbondata by apache.
the class RowLevelRangeGrtThanFiterExecuterImpl method ifDefaultValueMatchesFilter.
/**
* This method will check whether default value is present in the given filter values
*/
private void ifDefaultValueMatchesFilter() {
if (!dimColEvaluatorInfoList.isEmpty() && !isDimensionPresentInCurrentBlock[0]) {
CarbonDimension dimension = this.dimColEvaluatorInfoList.get(0).getDimension();
byte[] defaultValue = dimension.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < filterRangeValues.length; k++) {
int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterRangeValues[k], defaultValue);
if (maxCompare < 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
} else if (!msrColEvalutorInfoList.isEmpty() && !isMeasurePresentInCurrentBlock[0]) {
CarbonMeasure measure = this.msrColEvalutorInfoList.get(0).getMeasure();
byte[] defaultValue = measure.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < msrFilterRangeValues.length; k++) {
int maxCompare = comparator.compare(msrFilterRangeValues[k], DataTypeUtil.getMeasureObjectFromDataType(defaultValue, measure.getDataType()));
if (maxCompare < 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure in project carbondata by apache.
the class RowLevelRangeLessThanEqualFilterExecuterImpl method ifDefaultValueMatchesFilter.
/**
* This method will check whether default value is present in the given filter values
*/
private void ifDefaultValueMatchesFilter() {
if (!dimColEvaluatorInfoList.isEmpty() && !isDimensionPresentInCurrentBlock[0]) {
CarbonDimension dimension = this.dimColEvaluatorInfoList.get(0).getDimension();
byte[] defaultValue = dimension.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < filterRangeValues.length; k++) {
int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterRangeValues[k], defaultValue);
if (maxCompare >= 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
} else if (!msrColEvalutorInfoList.isEmpty() && !isMeasurePresentInCurrentBlock[0]) {
CarbonMeasure measure = this.msrColEvalutorInfoList.get(0).getMeasure();
byte[] defaultValue = measure.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < msrFilterRangeValues.length; k++) {
int maxCompare = comparator.compare(msrFilterRangeValues[k], DataTypeUtil.getMeasureObjectFromDataType(defaultValue, measure.getDataType()));
if (maxCompare >= 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure in project carbondata by apache.
the class RowLevelRangeLessThanFiterExecuterImpl method ifDefaultValueMatchesFilter.
/**
* This method will check whether default value is present in the given filter values
*/
private void ifDefaultValueMatchesFilter() {
if (!dimColEvaluatorInfoList.isEmpty() && !isDimensionPresentInCurrentBlock[0]) {
CarbonDimension dimension = this.dimColEvaluatorInfoList.get(0).getDimension();
byte[] defaultValue = dimension.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < filterRangeValues.length; k++) {
int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterRangeValues[k], defaultValue);
if (maxCompare > 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
} else if (!msrColEvalutorInfoList.isEmpty() && !isMeasurePresentInCurrentBlock[0]) {
CarbonMeasure measure = this.msrColEvalutorInfoList.get(0).getMeasure();
byte[] defaultValue = measure.getDefaultValue();
if (null != defaultValue) {
for (int k = 0; k < msrFilterRangeValues.length; k++) {
Object convertedValue = DataTypeUtil.getMeasureObjectFromDataType(defaultValue, measure.getDataType());
int maxCompare = comparator.compare(msrFilterRangeValues[k], convertedValue);
if (maxCompare > 0) {
isDefaultValuePresentInFilter = true;
break;
}
}
}
}
}
use of org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure in project carbondata by apache.
the class QueryModelBuilder method build.
public QueryModel build(Expression filterExpression) {
QueryProjection projection = new QueryProjection();
List<CarbonDimension> dimensions = carbonTable.getDimensions();
for (int i = 0; i < dimensions.size(); i++) {
projection.addDimension(dimensions.get(i), i);
}
List<CarbonMeasure> measures = carbonTable.getMeasures();
for (int i = 0; i < measures.size(); i++) {
projection.addMeasure(measures.get(i), i);
}
QueryModel queryModel = QueryModel.newInstance(carbonTable);
queryModel.setProjection(projection);
boolean[] isFilterDimensions = new boolean[carbonTable.getDimensionOrdinalMax()];
boolean[] isFilterMeasures = new boolean[carbonTable.getAllMeasures().size()];
carbonTable.processFilterExpression(filterExpression, isFilterDimensions, isFilterMeasures);
queryModel.setIsFilterDimensions(isFilterDimensions);
queryModel.setIsFilterMeasures(isFilterMeasures);
FilterResolverIntf filterIntf = carbonTable.resolveFilter(filterExpression, null);
queryModel.setFilterExpressionResolverTree(filterIntf);
return queryModel;
}
Aggregations