public enum VoltType extends java.lang.Enum<VoltType>
VoltTable
column or a SQLStmt
parameter.
Note that types in the database don't map 1-1 with types in the
Java Stored Procedure API. For example,
VARBINARY has no equivalent java class -- just byte[].
TIMESTAMP corresponds "best" to VoltDB.TimeStampType but
also, conveniently, to java.sql.Types.TIMESTAMP.Enum Constant and Description |
---|
BIGINT
8-byte signed 2s-compliment long.
|
BOOLEAN
Boolean type.
|
DECIMAL
Fixed precision=38, scale=12 storing sign and null-status in a preceding byte
|
FLOAT
8-bytes in IEEE 754 "double format".
|
GEOGRAPHY
Geography type, for geographical objects (polygons, etc)
|
GEOGRAPHY_POINT
Point type, for a geographical point (long, lat)
|
INLIST_OF_BIGINT
Special purpose internal type to describe expectations for parameters to
statements that contain syntax like " integer_expr IN ? ".
|
INLIST_OF_STRING
Special purpose internal type to describe expectations for parameters to
statements that contain syntax like " varchar_expr IN ? ".
|
INTEGER
4-byte signed 2s-compliment integer.
|
INVALID
Used for uninitialized types in some places.
|
NULL
Used to type java null values that have no type.
|
NUMERIC
Used for some literal constants parsed by our SQL parser.
|
SMALLINT
2-byte signed 2s-compliment short.
|
STRING
UTF-8 string with up to 32K chars.
|
TIMESTAMP
8-byte long value representing microseconds after the epoch.
|
TINYINT
1-byte signed 2s-compliment byte.
|
VARBINARY
Array of bytes of variable length
|
VOLTTABLE
VoltTable type for Procedure parameters
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_VALUE_LENGTH
Size in bytes of the maximum length for a VoltDB field value, presumably a
STRING or VARBINARY |
static int |
MAX_VALUE_LENGTH_IN_CHARACTERS |
static long |
NULL_BIGINT
Null value for
BIGINT . |
static org.voltdb.VoltType.NullDecimalSigil |
NULL_DECIMAL
Null value for
DECIMAL . |
static double |
NULL_FLOAT
Null value for
FLOAT . |
static org.voltdb.VoltType.NullGeographySigil |
NULL_GEOGRAPHY
Null value for
GEOGRAPHY . |
static int |
NULL_INTEGER
Null value for
INTEGER . |
static org.voltdb.VoltType.NullPointSigil |
NULL_POINT
Null value for
GEOGRAPHY_POINT . |
static short |
NULL_SMALLINT
Null value for
SMALLINT . |
static int |
NULL_STRING_LENGTH
Length value for a null string.
|
static org.voltdb.VoltType.NullStringOrVarbinarySigil |
NULL_STRING_OR_VARBINARY
Null value for
STRING or VARBINARY . |
static org.voltdb.VoltType.NullTimestampSigil |
NULL_TIMESTAMP
Null value for
TIMESTAMP . |
static byte |
NULL_TINYINT
Null value for
TINYINT . |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsArray(java.lang.Class<?> arrayArgClass)
Most VoltTypes are not compatible with an array-typed value.
|
java.lang.Object |
bytesToValue(byte[] value)
Converts a byte array with type back to the original partition value.
|
boolean |
canExactlyRepresentAnyValueOf(VoltType otherType) |
static java.lang.Class<?> |
classFromByteValue(byte value)
Return the java class that is matched to the given value.
|
java.lang.Class<?> |
classFromType()
Return the java class that is matched to a given VoltType.
|
int |
defaultLengthForVariableLengthType()
The size specifier for columns with a variable-length type is optional in a
CREATE TABLE or ALTER TABLE statement.
|
static VoltType |
get(byte val)
Statically create an enum value from the corresponding byte.
|
java.lang.String |
getCreateParams()
For JDBC, the name(s) of any type-specific parameter(s),
e.g.
|
java.lang.String |
getJdbcClass() |
int |
getJdbcSqlType()
Get the java.sql.Types type of this type.
|
int |
getLengthInBytesForFixedTypes()
Get the number of bytes required to store the fixed length type.
|
int |
getLengthInBytesForFixedTypesWithoutCheck() |
java.lang.String |
getLiteralPrefix()
For JDBC, returns the prefix (if any, otherwise null)
used with SQL literal constants of this type.
|
java.lang.String |
getLiteralSuffix()
For JDBC, returns the suffix (if any, otherwise null)
used with SQL literal constants of this type.
|
java.lang.Integer |
getMaximumScale()
Non-integer numeric VoltTypes must override this method.
|
int |
getMaxLengthInBytes()
Get the maximum number of bytes required to store the type
|
java.lang.String |
getMaxValueForKeyPadding() |
java.lang.Integer |
getMinimumScale()
Non-integer numeric VoltTypes must override this method.
|
int |
getMinLengthInBytes()
Get the minimum number of bytes required to store the type
|
java.lang.String |
getMostCompatibleJavaTypeName() |
java.lang.String |
getName() |
int |
getNullable()
VoltDB treats nullability as orthogonal to type,
so all types are nullable.
|
java.lang.Object |
getNullValue()
Get a value representing whichever null value is appropriate for
the current VoltType enum.
|
int |
getSearchable() |
char |
getSignatureChar()
Get a char that uniquely identifies a type.
|
java.lang.Integer[] |
getTypePrecisionAndRadix() |
byte |
getValue()
Gets the byte that corresponds to the VoltType (for serialization).
|
static java.lang.String |
humanReadableSize(int size)
String representation of
MAX_VALUE_LENGTH . |
boolean |
isAnyIntegerType()
Is this type an integer type? True for
TINYINT , SMALLINT ,
INTEGER , BIGINT . |
boolean |
isBackendIntegerType()
Is this type an integer type in the EE?
True for
TINYINT , SMALLINT ,
INTEGER , BIGINT and TIMESTAMP . |
boolean |
isCaseSensitive()
Individual VoltTypes like String can override to enable this functionality.
|
boolean |
isExactNumeric()
Is the type a number and is it an exact value (no rounding errors)?
|
boolean |
isIndexable()
VoltTypes for indexable non-numeric values must override.
|
boolean |
isJdbcVisible()
Is this type visible to JDBC
|
boolean |
isNumber() |
boolean |
isUniqueIndexable()
VoltTypes with special restrictions about uniqueness support must override.
|
java.lang.Boolean |
isUnsigned()
Numeric types are all signed types, so return false.
|
boolean |
isVariableLength() |
static boolean |
isVoltNullValue(java.lang.Object obj) |
java.lang.String |
toSQLString()
Get the corresponding SQL type as for a given VoltType enum.
|
java.lang.String |
toString()
Return the string representation of this type.
|
static VoltType |
typeFromClass(java.lang.Class<?> cls)
Ascertain the most appropriate VoltType given a
java class.
|
static VoltType |
typeFromObject(java.lang.Object obj)
Ascertain the most appropriate VoltType given a
java object.
|
static VoltType |
typeFromString(java.lang.String str)
Converts string representations to an enum value.
|
static VoltType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static VoltType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static byte[] |
valueToBytes(java.lang.Object obj)
Converts the object into bytes for hashing.
|
java.lang.Class<?> |
vectorClassFromType()
Return the java class that is matched to a given VoltType.
|
public static final VoltType INVALID
public static final VoltType NULL
public static final VoltType NUMERIC
DECIMAL
for decimal
type.public static final VoltType TINYINT
public static final VoltType SMALLINT
public static final VoltType INTEGER
public static final VoltType BIGINT
public static final VoltType INLIST_OF_BIGINT
public static final VoltType FLOAT
public static final VoltType STRING
public static final VoltType INLIST_OF_STRING
public static final VoltType TIMESTAMP
public static final VoltType VOLTTABLE
public static final VoltType DECIMAL
public static final VoltType BOOLEAN
public static final VoltType VARBINARY
public static final VoltType GEOGRAPHY_POINT
public static final VoltType GEOGRAPHY
public static final int MAX_VALUE_LENGTH
STRING
or VARBINARY
public static final int MAX_VALUE_LENGTH_IN_CHARACTERS
public static final int NULL_STRING_LENGTH
public static final byte NULL_TINYINT
TINYINT
.public static final short NULL_SMALLINT
SMALLINT
.public static final int NULL_INTEGER
INTEGER
.public static final long NULL_BIGINT
BIGINT
.public static final double NULL_FLOAT
FLOAT
.public static final org.voltdb.VoltType.NullTimestampSigil NULL_TIMESTAMP
TIMESTAMP
.public static final org.voltdb.VoltType.NullStringOrVarbinarySigil NULL_STRING_OR_VARBINARY
STRING
or VARBINARY
.public static final org.voltdb.VoltType.NullDecimalSigil NULL_DECIMAL
DECIMAL
.public static final org.voltdb.VoltType.NullPointSigil NULL_POINT
GEOGRAPHY_POINT
.public static final org.voltdb.VoltType.NullGeographySigil NULL_GEOGRAPHY
GEOGRAPHY
.public static VoltType[] values()
for (VoltType c : VoltType.values()) System.out.println(c);
public static VoltType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static java.lang.String humanReadableSize(int size)
MAX_VALUE_LENGTH
.size
- The size you want to represent in human readable string.public byte getValue()
public java.lang.Class<?> classFromType()
java.lang.RuntimeException
- if a type doesn't have an associated class,
such as INVALID
.typeFromClass(java.lang.Class<?>)
public static java.lang.Class<?> classFromByteValue(byte value)
value
- public java.lang.Class<?> vectorClassFromType()
java.lang.RuntimeException
- if a type doesn't have an associated class,
such as INVALID
.typeFromClass(java.lang.Class<?>)
public static VoltType get(byte val)
val
- A byte representing an enum valuepublic static VoltType typeFromString(java.lang.String str)
str
- A string in the form "TYPENAME" or "VoltType.TYPENAME",
e.g. "BIGINT" or "VoltType.VARCHAR"public static VoltType typeFromObject(java.lang.Object obj)
obj
- The java object to type.VoltTypeException
- if none applies.typeFromClass(java.lang.Class<?>)
public static VoltType typeFromClass(java.lang.Class<?> cls)
cls
- The java class to type.VoltTypeException
- if none applies.typeFromObject(java.lang.Object)
,
classFromType()
public java.lang.String toString()
toString
in class java.lang.Enum<VoltType>
public java.lang.String getName()
public boolean isVariableLength()
public int getLengthInBytesForFixedTypes()
public int getLengthInBytesForFixedTypesWithoutCheck()
public int getMinLengthInBytes()
public int getMaxLengthInBytes()
public java.lang.String getLiteralPrefix()
public java.lang.String getLiteralSuffix()
public java.lang.String getCreateParams()
public boolean isCaseSensitive()
public java.lang.Integer getMinimumScale()
public java.lang.Integer getMaximumScale()
public boolean isIndexable()
public boolean isUniqueIndexable()
public boolean acceptsArray(java.lang.Class<?> arrayArgClass)
arrayArgClass
- a java array class like byte[] or String[]VARBINARY
public java.lang.String toSQLString()
STRING
will probably convert to "VARCHAR".public boolean isJdbcVisible()
Is this type visible to JDBC
public int getJdbcSqlType()
public int getNullable()
public int getSearchable()
public java.lang.Boolean isUnsigned()
public java.lang.String getJdbcClass()
public boolean isExactNumeric()
public boolean isBackendIntegerType()
TINYINT
, SMALLINT
,
INTEGER
, BIGINT
and TIMESTAMP
.public boolean isAnyIntegerType()
TINYINT
, SMALLINT
,
INTEGER
, BIGINT
.public boolean isNumber()
public boolean canExactlyRepresentAnyValueOf(VoltType otherType)
public char getSignatureChar()
public java.lang.Integer[] getTypePrecisionAndRadix()
public int defaultLengthForVariableLengthType()
public java.lang.String getMostCompatibleJavaTypeName()
public java.lang.String getMaxValueForKeyPadding()
public java.lang.Object getNullValue()
TINYINT
, this will return a java byte with value
-128, which is the constant NULL_TINYINT in VoltDB.public static boolean isVoltNullValue(java.lang.Object obj)
public static byte[] valueToBytes(java.lang.Object obj)
obj
- a value to be hashedpublic java.lang.Object bytesToValue(byte[] value)
value
- Byte array representation of partition parameter.