Package org.apache.gravitino.rel.types
Class Decimal
java.lang.Object
org.apache.gravitino.rel.types.Decimal
Used to represent a
Types.DecimalType value in Apache Gravitino.
For Decimal, we expect the precision is equal to or larger than the scale, however, in BigDecimal, the digit count starts from the leftmost nonzero digit of the exact result. For
example, the precision of 0.01 equals to 1 based on the definition, but the scale is 2. The
expected precision should be 2.
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static DecimalCreates a decimal value with the given value.static DecimalCreates a decimal value with the given value, precision and scale.static Decimalof(BigDecimal value) Creates a decimal value with the given value.static Decimalof(BigDecimal value, int precision, int scale) Creates a decimal value with the given value, precision and scale.intintscale()toString()value()
-
Method Details
-
of
Creates a decimal value with the given value, precision and scale.- Parameters:
value- The value of the decimal.precision- The precision of the decimal.scale- The scale of the decimal.- Returns:
- A new
Decimalinstance.
-
of
Creates a decimal value with the given value.- Parameters:
value- The value of the decimal.- Returns:
- A new
Decimalinstance.
-
of
Creates a decimal value with the given value.- Parameters:
value- The value of the decimal.- Returns:
- A new
Decimalinstance.
-
of
Creates a decimal value with the given value, precision and scale.- Parameters:
value- The value of the decimal.precision- The precision of the decimal.scale- The scale of the decimal.- Returns:
- A new
Decimalinstance.
-
value
- Returns:
- The value of the decimal.
-
precision
public int precision()- Returns:
- The precision of the decimal.
-
scale
public int scale()- Returns:
- The scale of the decimal.
-
toString
-
equals
-
hashCode
public int hashCode()
-