/** * This method will convert a given value to its specific type * * @param msrValue * @param dataType * @return */ public static Object getMeasureValueBasedOnDataType(String msrValue, DataType dataType, int scale, int precision) { return getMeasureValueBasedOnDataType(msrValue, dataType, scale, precision, false); }
.getMeasureValueBasedOnDataType(result, dataType, carbonMeasure.getScale(), carbonMeasure.getPrecision()));
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.getScale(), carbonMeasure.getPrecision())); } 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; }
if (dataField.isUseActualData()) { output = DataTypeUtil .getMeasureValueBasedOnDataType(literalValue, dataField.getColumn().getDataType(), dataField.getColumn().getColumnSchema().getScale(), dataField.getColumn().getColumnSchema().getPrecision(), true); } else { output = DataTypeUtil .getMeasureValueBasedOnDataType(literalValue, dataField.getColumn().getDataType(), dataField.getColumn().getColumnSchema().getScale(), dataField.getColumn().getColumnSchema().getPrecision());