public class DecimalType extends NumericType implements scala.Product, scala.Serializable
java.math.BigDecimal
values.
A Decimal that must have fixed precision (the maximum number of digits) and scale (the number
of digits on right side of dot).
The precision can be up to 38, scale can also be up to 38 (less or equal to precision).
The default precision and scale is (10, 0).
Please use DataTypes.createDecimalType()
to create a specific instance.
Modifier and Type | Class and Description |
---|---|
static class |
DecimalType.Expression$ |
static class |
DecimalType.Fixed$ |
Constructor and Description |
---|
DecimalType() |
DecimalType(int precision) |
DecimalType(int precision,
int scale) |
Modifier and Type | Method and Description |
---|---|
static int |
DEFAULT_SCALE() |
int |
defaultSize()
The default size of a value of the DecimalType is 8 bytes when precision is at most 18,
and 16 bytes otherwise.
|
static boolean |
is32BitDecimalType(DataType dt)
Returns if dt is a DecimalType that fits inside an int
|
static boolean |
is64BitDecimalType(DataType dt)
Returns if dt is a DecimalType that fits inside a long
|
static boolean |
isByteArrayDecimalType(DataType dt)
Returns if dt is a DecimalType that doesn't fit inside a long
|
static int |
MAX_PRECISION() |
static int |
MAX_SCALE() |
static int |
MINIMUM_ADJUSTED_SCALE() |
int |
precision() |
int |
scale() |
String |
simpleString() |
String |
sql() |
static DecimalType |
SYSTEM_DEFAULT() |
String |
toString() |
String |
typeName()
Name of the type used in JSON serialization.
|
static boolean |
unapply(DataType t) |
static boolean |
unapply(org.apache.spark.sql.catalyst.expressions.Expression e) |
static DecimalType |
USER_DEFAULT() |
canWrite, catalogString, equalsStructurally, equalsStructurallyByName, fromDDL, fromJson, json, parseTypeWithFallback, prettyJson
public DecimalType(int precision, int scale)
public DecimalType(int precision)
public DecimalType()
public static int MAX_PRECISION()
public static int MAX_SCALE()
public static int DEFAULT_SCALE()
public static DecimalType SYSTEM_DEFAULT()
public static DecimalType USER_DEFAULT()
public static int MINIMUM_ADJUSTED_SCALE()
public static boolean is32BitDecimalType(DataType dt)
dt
- (undocumented)public static boolean is64BitDecimalType(DataType dt)
dt
- (undocumented)public static boolean isByteArrayDecimalType(DataType dt)
dt
- (undocumented)public static boolean unapply(DataType t)
public static boolean unapply(org.apache.spark.sql.catalyst.expressions.Expression e)
public int precision()
public int scale()
public String typeName()
DataType
public String toString()
toString
in class Object
public int defaultSize()
defaultSize
in class DataType
public String simpleString()