Package com.clickhouse.data
Enum ClickHouseDataType
- All Implemented Interfaces:
Serializable,Comparable<ClickHouseDataType>,java.lang.constant.Constable
Basic ClickHouse data types.
This list is based on the list of data type families returned by
SELECT * FROM system.data_type_families
LowCardinality and Nullable are technically data types in
ClickHouse, but for the sake of this driver, we treat these data types as
modifiers for the underlying base data types.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionImmutable set(sorted) for all aliases.static final Map<String,ClickHouseDataType> Immutable mapping between name and type. -
Method Summary
Modifier and TypeMethodDescriptionGets immutable list of aliases for this data type.intGets byte length of this data type.intGets default scale of this data type.intGets maximum precision of this data type.intGets maximum scale of this data type.intGets minimum scale of this data type.Class<?>Gets Java class for this data type.Class<?>Gets Java class for this data type.Class<?>Gets Java class for this data type.Class<?>Gets Java class for this data type.booleanChecks if this data type may have parameter(s).static booleanChecks if the given type name is an alias or not.booleanChecks if name of this data type is case sensitive or not.booleanisNested()Checks if this data type uses a nested structure.booleanisSigned()Checks if this data type represents signed number.Finds list of matched aliases and/or types based on given part.static booleanmayStartWith(String... prefixes) Checks if any alias uses the given prefixes.static ClickHouseDataTypeConverts given type name to corresponding data type.static Class<?>toObjectType(Class<?> javaClass) Converts given Java class to wrapper object(e.g.static Class<?>toPrimitiveType(Class<?> javaClass) Converts given Java class to primitive types(e.g.static Class<?>toWiderObjectType(Class<?> javaClass) Converts given Java class to wider wrapper object(e.g.static Class<?>toWiderPrimitiveType(Class<?> javaClass) Converts given Java class to wider primitive types(e.g.static ClickHouseDataTypeReturns the enum constant of this type with the specified name.static ClickHouseDataType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
Bool
-
Date
-
Date32
-
DateTime
-
DateTime32
-
DateTime64
-
Enum8
-
Enum16
-
FixedString
-
Int8
-
UInt8
-
Int16
-
UInt16
-
Int32
-
UInt32
-
Int64
-
IntervalYear
-
IntervalQuarter
-
IntervalMonth
-
IntervalWeek
-
IntervalDay
-
IntervalHour
-
IntervalMinute
-
IntervalSecond
-
IntervalMicrosecond
-
IntervalMillisecond
-
IntervalNanosecond
-
UInt64
-
Int128
-
UInt128
-
Int256
-
UInt256
-
Decimal
-
Decimal32
-
Decimal64
-
Decimal128
-
Decimal256
-
Float32
-
Float64
-
IPv4
-
IPv6
-
UUID
-
Point
-
Polygon
-
MultiPolygon
-
Ring
-
JSON
-
Object
-
String
-
Array
-
Map
-
Nested
-
Tuple
-
Nothing
-
SimpleAggregateFunction
-
AggregateFunction
-
-
Field Details
-
allAliases
Immutable set(sorted) for all aliases. -
name2type
Immutable mapping between name and type.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
isAlias
Checks if the given type name is an alias or not.- Parameters:
typeName- type name- Returns:
- true if the type name is an alias; false otherwise
-
match
Finds list of matched aliases and/or types based on given part.- Parameters:
part- prefix, alias or type name- Returns:
- list of matched aliases and/or types
-
mayStartWith
Checks if any alias uses the given prefixes.- Parameters:
prefixes- prefixes to check- Returns:
- true if any alias using the given prefixes; false otherwise
-
of
Converts given type name to corresponding data type.- Parameters:
typeName- non-empty type name- Returns:
- data type
-
toObjectType
Converts given Java class to wrapper object(e.g.int.classtoInteger.class) if applicable.- Parameters:
javaClass- Java class- Returns:
- wrapper object
-
toWiderObjectType
Converts given Java class to wider wrapper object(e.g.int.classtoLong.class) if applicable.- Parameters:
javaClass- Java class- Returns:
- wrapper object
-
toPrimitiveType
Converts given Java class to primitive types(e.g.Integer.classtoint.class) if applicable.- Parameters:
javaClass- Java class- Returns:
- primitive type
-
toWiderPrimitiveType
Converts given Java class to wider primitive types(e.g.Integer.classtolong.class) if applicable.- Parameters:
javaClass- Java class- Returns:
- primitive type
-
getObjectClass
Gets Java class for this data type. Prefer wrapper objects to primitives(e.g.Integer.classinstead ofint.class).- Returns:
- Java class
-
getWiderObjectClass
Gets Java class for this data type. Prefer wrapper objects to primitives(e.g.Integer.classinstead ofint.class).- Returns:
- Java class
-
getPrimitiveClass
Gets Java class for this data type. Prefer primitives to wrapper objects(e.g.int.classinstead ofInteger.class).- Returns:
- Java class
-
getWiderPrimitiveClass
Gets Java class for this data type. Prefer primitives to wrapper objects(e.g.int.classinstead ofInteger.class).- Returns:
- Java class
-
hasParameter
public boolean hasParameter()Checks if this data type may have parameter(s).- Returns:
- true if this data type may have parameter; false otherwise
-
isCaseSensitive
public boolean isCaseSensitive()Checks if name of this data type is case sensitive or not.- Returns:
- true if it's case sensitive; false otherwise
-
isNested
public boolean isNested()Checks if this data type uses a nested structure.- Returns:
- true if it uses a nested structure; false otherwise
-
isSigned
public boolean isSigned()Checks if this data type represents signed number.- Returns:
- true if it's signed; false otherwise
-
getAliases
Gets immutable list of aliases for this data type.- Returns:
- immutable list of aliases
-
getByteLength
public int getByteLength()Gets byte length of this data type. Zero means unlimited.- Returns:
- byte length of this data type
-
getMaxPrecision
public int getMaxPrecision()Gets maximum precision of this data type. Zero means unknown or not supported.- Returns:
- maximum precision of this data type.
-
getDefaultScale
public int getDefaultScale()Gets default scale of this data type. Zero means unknown or not supported.- Returns:
- default scale of this data type.
-
getMinScale
public int getMinScale()Gets minimum scale of this data type. Zero means unknown or not supported.- Returns:
- minimum scale of this data type.
-
getMaxScale
public int getMaxScale()Gets maximum scale of this data type. Zero means unknown or not supported.- Returns:
- maximum scale of this data type.
-