Package com.clickhouse.client
Enum ClickHouseDataType
- java.lang.Object
-
- java.lang.Enum<ClickHouseDataType>
-
- com.clickhouse.client.ClickHouseDataType
-
- All Implemented Interfaces:
Serializable
,Comparable<ClickHouseDataType>
public enum ClickHouseDataType extends Enum<ClickHouseDataType>
Basic ClickHouse data types.This list is based on the list of data type families returned by
SELECT * FROM system.data_type_families
LowCardinality
andNullable
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.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AggregateFunction
Array
Bool
Date
Date32
DateTime
DateTime32
DateTime64
Decimal
Decimal128
Decimal256
Decimal32
Decimal64
Enum
Deprecated.Enum16
Enum8
FixedString
Float32
Float64
Int128
Int16
Int256
Int32
Int64
Int8
IntervalDay
IntervalHour
IntervalMinute
IntervalMonth
IntervalQuarter
IntervalSecond
IntervalWeek
IntervalYear
IPv4
IPv6
Map
MultiPolygon
Nested
Nothing
Point
Polygon
Ring
SimpleAggregateFunction
String
Tuple
UInt128
UInt16
UInt256
UInt32
UInt64
UInt8
UUID
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
allAliases
Immutable set(sorted) for all aliases.static Map<String,ClickHouseDataType>
name2type
Immutable mapping between name and type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getAliases()
Gets immutable list of aliases for this data type.int
getByteLength()
Gets byte length of this data type.int
getDefaultScale()
Gets default scale of this data type.int
getMaxPrecision()
Gets maximum precision of this data type.int
getMaxScale()
Gets maximum scale of this data type.int
getMinScale()
Gets minimum scale of this data type.Class<?>
getObjectClass()
Gets Java class for this data type.Class<?>
getPrimitiveClass()
Gets Java class for this data type.boolean
hasParameter()
Checks if this data type may have parameter(s).static boolean
isAlias(String typeName)
Checks if the given type name is an alias or not.boolean
isCaseSensitive()
Checks if name of this data type is case sensistive or not.boolean
isNested()
Checks if this data type could be a nested structure.boolean
isSigned()
Checks if this data type represents signed number.static List<String>
match(String part)
static ClickHouseDataType
of(String typeName)
Converts 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 ClickHouseDataType
valueOf(String name)
Returns 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 Detail
-
IntervalYear
public static final ClickHouseDataType IntervalYear
-
IntervalQuarter
public static final ClickHouseDataType IntervalQuarter
-
IntervalMonth
public static final ClickHouseDataType IntervalMonth
-
IntervalWeek
public static final ClickHouseDataType IntervalWeek
-
IntervalDay
public static final ClickHouseDataType IntervalDay
-
IntervalHour
public static final ClickHouseDataType IntervalHour
-
IntervalMinute
public static final ClickHouseDataType IntervalMinute
-
IntervalSecond
public static final ClickHouseDataType IntervalSecond
-
UInt8
public static final ClickHouseDataType UInt8
-
UInt16
public static final ClickHouseDataType UInt16
-
UInt32
public static final ClickHouseDataType UInt32
-
UInt64
public static final ClickHouseDataType UInt64
-
UInt128
public static final ClickHouseDataType UInt128
-
UInt256
public static final ClickHouseDataType UInt256
-
Int8
public static final ClickHouseDataType Int8
-
Int16
public static final ClickHouseDataType Int16
-
Int32
public static final ClickHouseDataType Int32
-
Int64
public static final ClickHouseDataType Int64
-
Int128
public static final ClickHouseDataType Int128
-
Int256
public static final ClickHouseDataType Int256
-
Bool
public static final ClickHouseDataType Bool
-
Date
public static final ClickHouseDataType Date
-
Date32
public static final ClickHouseDataType Date32
-
DateTime
public static final ClickHouseDataType DateTime
-
DateTime32
public static final ClickHouseDataType DateTime32
-
DateTime64
public static final ClickHouseDataType DateTime64
-
Decimal
public static final ClickHouseDataType Decimal
-
Decimal32
public static final ClickHouseDataType Decimal32
-
Decimal64
public static final ClickHouseDataType Decimal64
-
Decimal128
public static final ClickHouseDataType Decimal128
-
Decimal256
public static final ClickHouseDataType Decimal256
-
UUID
public static final ClickHouseDataType UUID
-
Enum
@Deprecated public static final ClickHouseDataType Enum
Deprecated.
-
Enum8
public static final ClickHouseDataType Enum8
-
Enum16
public static final ClickHouseDataType Enum16
-
Float32
public static final ClickHouseDataType Float32
-
Float64
public static final ClickHouseDataType Float64
-
IPv4
public static final ClickHouseDataType IPv4
-
IPv6
public static final ClickHouseDataType IPv6
-
FixedString
public static final ClickHouseDataType FixedString
-
String
public static final ClickHouseDataType String
-
AggregateFunction
public static final ClickHouseDataType AggregateFunction
-
SimpleAggregateFunction
public static final ClickHouseDataType SimpleAggregateFunction
-
Array
public static final ClickHouseDataType Array
-
Map
public static final ClickHouseDataType Map
-
Nested
public static final ClickHouseDataType Nested
-
Tuple
public static final ClickHouseDataType Tuple
-
Point
public static final ClickHouseDataType Point
-
Polygon
public static final ClickHouseDataType Polygon
-
MultiPolygon
public static final ClickHouseDataType MultiPolygon
-
Ring
public static final ClickHouseDataType Ring
-
Nothing
public static final ClickHouseDataType Nothing
-
-
Field Detail
-
name2type
public static final Map<String,ClickHouseDataType> name2type
Immutable mapping between name and type.
-
-
Method Detail
-
values
public static ClickHouseDataType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ClickHouseDataType c : ClickHouseDataType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ClickHouseDataType valueOf(String name)
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
public static boolean isAlias(String typeName)
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
-
of
public static ClickHouseDataType of(String typeName)
Converts given type name to corresponding data type.- Parameters:
typeName
- non-empty type name- Returns:
- data type
-
toObjectType
public static Class<?> toObjectType(Class<?> javaClass)
Converts given Java class to wrapper object(e.g.int.class
toInteger.class
) if applicable.- Parameters:
javaClass
- Java class- Returns:
- wrapper object
-
toPrimitiveType
public static Class<?> toPrimitiveType(Class<?> javaClass)
Converts given Java class to primitive types(e.g.Integer.class
toint.class
) if applicable.- Parameters:
javaClass
- Java class- Returns:
- primitive type
-
getObjectClass
public Class<?> getObjectClass()
Gets Java class for this data type. Prefer wrapper objects to primitives(e.g.Integer.class
instead ofint.class
).- Returns:
- Java class
-
getPrimitiveClass
public Class<?> getPrimitiveClass()
Gets Java class for this data type. Prefer primitives to wrapper objects(e.g.int.class
instead 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 sensistive or not.- Returns:
- true if it's case sensitive; false otherwise
-
isNested
public boolean isNested()
Checks if this data type could be a nested structure.- Returns:
- true if it could be 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
public List<String> 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.
-
-