DecimalType (Spark 4.2.0 JavaDoc)
- All Implemented Interfaces:
Serializable,scala.Equals,scala.Product
The data type representing 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.
- Since:
- 1.3.0
- See Also:
-
Nested Class Summary
Nested Classes
-
Constructor Summary
Constructors
DecimalType(int precision) DecimalType(int precision, int scale) -
Method Summary
static intintThe default size of a value of the DecimalType is 8 bytes when precision is at most 18, and 16 bytes otherwise.
static booleanReturns if dt is a DecimalType that fits inside an int
static booleanReturns if dt is a DecimalType that fits inside a long
static booleanReturns if dt is a DecimalType that doesn't fit inside a long
static intstatic intstatic intintintscale()sql()toString()typeName()Name of the type used in JSON serialization.
static booleanMethods inherited from class org.apache.spark.sql.types.DataType
catalogString, COLLATIONS_METADATA_KEY, equalsIgnoreCaseAndNullability, equalsIgnoreNullability, equalsStructurally, equalsStructurallyByName, fromDDL, fromJson, json, parseTypeWithFallback, prettyJson, simpleStringMethods inherited from interface scala.Equals
canEqual, equalsMethods inherited from interface scala.Product
productArity, productElement, productElementName, productElementNames, productIterator, productPrefix
-
Constructor Details
-
DecimalType
public DecimalType
(int precision, int scale) -
DecimalType
public DecimalType
(int precision) -
DecimalType
public DecimalType()
-
-
Method Details
-
MAX_PRECISION
public static int MAX_PRECISION()
-
MAX_SCALE
public static int MAX_SCALE()
-
DEFAULT_SCALE
public static int DEFAULT_SCALE()
-
SYSTEM_DEFAULT
-
USER_DEFAULT
-
MINIMUM_ADJUSTED_SCALE
public static int MINIMUM_ADJUSTED_SCALE()
-
is32BitDecimalType
public static boolean is32BitDecimalType
(DataType dt) Returns if dt is a DecimalType that fits inside an int
- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
is64BitDecimalType
public static boolean is64BitDecimalType
(DataType dt) Returns if dt is a DecimalType that fits inside a long
- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
isByteArrayDecimalType
public static boolean isByteArrayDecimalType
(DataType dt) Returns if dt is a DecimalType that doesn't fit inside a long
- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
unapply
public static boolean unapply
(DataType t) -
precision
public int precision()
-
scale
public int scale()
-
typeName
Description copied from class:
DataTypeName of the type used in JSON serialization.
-
toString
-
sql
-
defaultSize
public int defaultSize()
The default size of a value of the DecimalType is 8 bytes when precision is at most 18, and 16 bytes otherwise.
- Specified by:
defaultSizein classDataType- Returns:
- (undocumented)
-
simpleString
public String simpleString()
-