Enum ClickHouseDataType

java.lang.Object
java.lang.Enum<ClickHouseDataType>
com.clickhouse.data.ClickHouseDataType
All Implemented Interfaces:
Serializable, Comparable<ClickHouseDataType>, java.lang.constant.Constable

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 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.

  • Enum Constant Details

  • Field Details

    • allAliases

      public static final Set<String> allAliases
      Immutable set(sorted) for all aliases.
    • name2type

      public static final Map<String,ClickHouseDataType> name2type
      Immutable mapping between name and type.
  • Method Details

    • values

      public static ClickHouseDataType[] 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

      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 name
      NullPointerException - 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
    • match

      public static List<String> match(String part)
      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

      public static boolean mayStartWith(String... prefixes)
      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

      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 to Integer.class) if applicable.
      Parameters:
      javaClass - Java class
      Returns:
      wrapper object
    • toWiderObjectType

      public static Class<?> toWiderObjectType(Class<?> javaClass)
      Converts given Java class to wider wrapper object(e.g. int.class to Long.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 to int.class) if applicable.
      Parameters:
      javaClass - Java class
      Returns:
      primitive type
    • toWiderPrimitiveType

      public static Class<?> toWiderPrimitiveType(Class<?> javaClass)
      Converts given Java class to wider primitive types(e.g. Integer.class to long.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 of int.class).
      Returns:
      Java class
    • getWiderObjectClass

      public Class<?> getWiderObjectClass()
      Gets Java class for this data type. Prefer wrapper objects to primitives(e.g. Integer.class instead of int.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 of Integer.class).
      Returns:
      Java class
    • getWiderPrimitiveClass

      public Class<?> getWiderPrimitiveClass()
      Gets Java class for this data type. Prefer primitives to wrapper objects(e.g. int.class instead of Integer.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

      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.