@Test public void testFormatValue() { double value = Long.MAX_VALUE; assertEquals(AggregationFunctionUtils.formatValue(value), "9223372036854775807.00000"); value = Long.MIN_VALUE; assertEquals(AggregationFunctionUtils.formatValue(value), "-9223372036854775808.00000"); value = 1e30; assertEquals(AggregationFunctionUtils.formatValue(value), "1000000000000000000000000000000.00000"); value = -1e30; assertEquals(AggregationFunctionUtils.formatValue(value), "-1000000000000000000000000000000.00000"); value = 1e-3; assertEquals(AggregationFunctionUtils.formatValue(value), "0.00100"); value = -1e-3; assertEquals(AggregationFunctionUtils.formatValue(value), "-0.00100"); value = 1e-10; assertEquals(AggregationFunctionUtils.formatValue(value), "0.00000"); value = -1e-10; assertEquals(AggregationFunctionUtils.formatValue(value), "-0.00000"); value = 123.456789; assertEquals(AggregationFunctionUtils.formatValue(value), "123.45679"); value = Double.POSITIVE_INFINITY; assertEquals(AggregationFunctionUtils.formatValue(value), "Infinity"); value = Double.NEGATIVE_INFINITY; assertEquals(AggregationFunctionUtils.formatValue(value), "-Infinity"); value = Double.NaN; assertEquals(AggregationFunctionUtils.formatValue(value), "NaN"); }
public static String formatValue(Object value) { if (value instanceof Double) { double doubleValue = (double) value; if (doubleValue <= Long.MAX_VALUE && doubleValue >= Long.MIN_VALUE && DoubleMath .isMathematicalInteger(doubleValue)) { return (long) doubleValue + ".00000"; } else { return String.format(Locale.US, "%1.5f", doubleValue); } } else { return value.toString(); } }
AggregationFunctionUtils { public static String formatValue(Object value) { if (value instanceof Double) { double doubleValue = (double) value; if (doubleValue <= Long.MAX_VALUE && doubleValue >= Long.MIN_VALUE && DoubleMath .isMathematicalInteger(doubleValue)) { return (long) doubleValue + ".00000"; } else { return String.format(Locale.US, "%1.5f", doubleValue); } } else { return value.toString(); } } }
AggregationFunctionUtils { public static String formatValue(Object value) { if (value instanceof Double) { double doubleValue = (double) value; if (doubleValue <= Long.MAX_VALUE && doubleValue >= Long.MIN_VALUE && DoubleMath .isMathematicalInteger(doubleValue)) { return (long) doubleValue + ".00000"; } else { return String.format(Locale.US, "%1.5f", doubleValue); } } else { return value.toString(); } } private  AggregationFunctionUtils(); }
AggregationFunctionUtils { public static String formatValue(Object value) { if (value instanceof Double) { double doubleValue = (double) value; if (doubleValue <= Long.MAX_VALUE && doubleValue >= Long.MIN_VALUE && DoubleMath .isMathematicalInteger(doubleValue)) { return (long) doubleValue + ".00000"; } else { return String.format(Locale.US, "%1.5f", doubleValue); } } else { return value.toString(); } } private  AggregationFunctionUtils(); static List<String> getArguments(AggregationInfo aggregationInfo); @Nullable static AggregationFunctionColumnPair getAggregationFunctionColumnPair(
      AggregationFunction aggregationFunction); static String formatValue(Object value); static Serializable getSerializableValue(Object value); static String concatArgs(String[] arguments); static Set<ExpressionContext> collectExpressionsToTransform(AggregationFunction[] aggregationFunctions,
      @Nullable ExpressionContext[] groupByExpressions); static Map<ExpressionContext, BlockValSet> getBlockValSetMap(AggregationFunction aggregationFunction,
      TransformBlock transformBlock); static Map<ExpressionContext, BlockValSet> getBlockValSetMap(
      AggregationFunctionColumnPair aggregationFunctionColumnPair, TransformBlock transformBlock); static boolean isFitForDictionaryBasedComputation(String functionName); }
AggregationFunctionUtils { public static String formatValue(Object value) { if (value instanceof Double) { double doubleValue = (double) value; if (doubleValue <= Long.MAX_VALUE && doubleValue >= Long.MIN_VALUE && DoubleMath .isMathematicalInteger(doubleValue)) { return (long) doubleValue + ".00000"; } else { return String.format(Locale.US, "%1.5f", doubleValue); } } else { return value.toString(); } } private  AggregationFunctionUtils(); static List<String> getArguments(AggregationInfo aggregationInfo); @Nullable static AggregationFunctionColumnPair getAggregationFunctionColumnPair(
      AggregationFunction aggregationFunction); static String formatValue(Object value); static Serializable getSerializableValue(Object value); static String concatArgs(String[] arguments); static Set<ExpressionContext> collectExpressionsToTransform(AggregationFunction[] aggregationFunctions,
      @Nullable ExpressionContext[] groupByExpressions); static Map<ExpressionContext, BlockValSet> getBlockValSetMap(AggregationFunction aggregationFunction,
      TransformBlock transformBlock); static Map<ExpressionContext, BlockValSet> getBlockValSetMap(
      AggregationFunctionColumnPair aggregationFunctionColumnPair, TransformBlock transformBlock); static boolean isFitForDictionaryBasedComputation(String functionName);  }