org.apache.hadoop.hive.ql.udf.generic
Class RoundUtils
java.lang.Object
org.apache.hadoop.hive.ql.udf.generic.RoundUtils
public class RoundUtils
- extends Object
Utility class for generic round UDF.
Method Summary |
static double |
round(double input,
int scale)
Rounding a double is approximate, as the double value itself is approximate. |
static HiveDecimal |
round(HiveDecimal input,
int scale)
|
static long |
round(long input,
int scale)
|
round
public static double round(double input,
int scale)
- Rounding a double is approximate, as the double value itself is approximate.
A double literal, such as 3.15, may not be represented internally exactly as
3.15. thus, the rounding value of it can be off on the surface. For accurate
rounding, consider using decimal type.
- Parameters:
input
- input valuescale
- decimal place
- Returns:
- rounded value
round
public static long round(long input,
int scale)
round
public static HiveDecimal round(HiveDecimal input,
int scale)
Copyright © 2014 The Apache Software Foundation. All rights reserved.