use of org.apache.carbondata.core.scan.expression.conditional.BinaryConditionalExpression in project carbondata by apache.
the class RowLevelRangeFilterResolverImpl method getNoDictionaryRangeValues.
private List<byte[]> getNoDictionaryRangeValues() {
List<ExpressionResult> listOfExpressionResults = new ArrayList<ExpressionResult>(20);
if (this.getFilterExpression() instanceof BinaryConditionalExpression) {
listOfExpressionResults = ((BinaryConditionalExpression) this.getFilterExpression()).getLiterals();
}
List<byte[]> filterValuesList = new ArrayList<byte[]>(20);
boolean invalidRowsPresent = false;
String timeFormat = CarbonProperties.getInstance().getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
for (ExpressionResult result : listOfExpressionResults) {
try {
if (result.getString() == null) {
if (result.getDataType() == DataTypes.STRING) {
filterValuesList.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL_ARRAY);
} else {
filterValuesList.add(CarbonCommonConstants.EMPTY_BYTE_ARRAY);
}
continue;
}
filterValuesList.add(DataTypeUtil.getBytesBasedOnDataTypeForNoDictionaryColumn(result.getString(), result.getDataType(), timeFormat));
} catch (FilterIllegalMemberException e) {
// Any invalid member while evaluation shall be ignored, system will log the
// error only once since all rows the evaluation happens so inorder to avoid
// too much log inforation only once the log will be printed.
FilterUtil.logError(e, invalidRowsPresent);
}
}
Comparator<byte[]> filterNoDictValueComaparator = new Comparator<byte[]>() {
@Override
public int compare(byte[] filterMember1, byte[] filterMember2) {
return ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterMember1, filterMember2);
}
};
Collections.sort(filterValuesList, filterNoDictValueComaparator);
return filterValuesList;
}
use of org.apache.carbondata.core.scan.expression.conditional.BinaryConditionalExpression in project carbondata by apache.
the class RowLevelRangeFilterResolverImpl method getMeasureRangeValues.
private List<Object> getMeasureRangeValues(CarbonMeasure carbonMeasure) {
List<ExpressionResult> listOfExpressionResults = new ArrayList<ExpressionResult>(20);
if (this.getFilterExpression() instanceof BinaryConditionalExpression) {
listOfExpressionResults = ((BinaryConditionalExpression) this.getFilterExpression()).getLiterals();
}
List<Object> filterValuesList = new ArrayList<>(20);
boolean invalidRowsPresent = false;
for (ExpressionResult result : listOfExpressionResults) {
try {
if (result.getString() == null) {
filterValuesList.add(null);
continue;
}
filterValuesList.add(DataTypeUtil.getMeasureValueBasedOnDataType(result.getString(), result.getDataType(), carbonMeasure));
} catch (FilterIllegalMemberException e) {
// Any invalid member while evaluation shall be ignored, system will log the
// error only once since all rows the evaluation happens so inorder to avoid
// too much log inforation only once the log will be printed.
FilterUtil.logError(e, invalidRowsPresent);
}
}
Collections.sort(filterValuesList, org.apache.carbondata.core.util.comparator.Comparator.getComparatorByDataTypeForMeasure(carbonMeasure.getDataType()));
return filterValuesList;
}
Aggregations