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

    • Field Detail

      • allAliases

        public static final Set<String> allAliases
        Immutable set(sorted) for all aliases.
    • 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 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
      • 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
      • 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
      • 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
      • 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
      • 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.