Package org.apache.spark.sql.types
Class DecimalType
Object
org.apache.spark.sql.types.DataType
org.apache.spark.sql.types.NumericType
org.apache.spark.sql.types.DecimalType
- 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 intstatic booleanReturns if dt is a DecimalType that fits inside a longstatic booleanReturns if dt is a DecimalType that doesn't fit inside a longstatic intstatic intstatic intintintscale()sql()static DecimalTypetoString()typeName()Name of the type used in JSON serialization.static booleanstatic DecimalTypeMethods 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 class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
Returns if dt is a DecimalType that fits inside an int- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
is64BitDecimalType
Returns if dt is a DecimalType that fits inside a long- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
isByteArrayDecimalType
Returns if dt is a DecimalType that doesn't fit inside a long- Parameters:
dt- (undocumented)- Returns:
- (undocumented)
-
unapply
-
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
-