Package org.apache.druid.segment.column
Class ColumnType
java.lang.Object
org.apache.druid.segment.column.BaseTypeSignature<ValueType>
org.apache.druid.segment.column.ColumnType
- All Implemented Interfaces:
Cacheable,TypeSignature<ValueType>
Native Druid types.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ColumnTypeDruid 64-bit double precision floating point number primitive type.static final ColumnTypeAn array of Doubles.static final ColumnTypeDruid 32-bit single precision floating point number primitive type.static final ColumnTypeAn array of Floats.static final ColumnTypeDruid 64-bit integer number primitive type.static final ColumnTypeAn array of Longs.static final ColumnTypestatic final ColumnTypeDruid string type.static final ColumnTypeAn array of Strings.static final ColumnTypePlaceholder type for an "unknown" complex, which is used when the complex type name was "lost" or unavailable for whatever reason, to indicate an opaque type that cannot be generically handled with normal complex type handling mechanisms.Fields inherited from class org.apache.druid.segment.column.BaseTypeSignature
complexTypeName, elementType, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ColumnTypefromCapabilities(ColumnCapabilities capabilities) static ColumnTypefromString(String typeName) byte[]Get a byte array used as a cache key.static ColumnTypeleastRestrictiveType(Iterable<ColumnType> types) static ColumnTypeleastRestrictiveType(ColumnType type, ColumnType other) Finds the type that can best represent both types, or none if there is no type information.static ColumnTypeofArray(ColumnType elementType) static ColumnTypeMethods inherited from class org.apache.druid.segment.column.BaseTypeSignature
equals, getComplexTypeName, getElementType, getNullableStrategy, getStrategy, getType, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.segment.column.TypeSignature
anyOf, asTypeString, is, isArray, isNumeric, isPrimitive, isPrimitiveArray
-
Field Details
-
STRING
Druid string type. Values will be represented asStringorList<String>in the case of multi-value string columns.ColumnTypehas insufficient information to distinguish between single and multi-value strings, this requires a specificTypeSignatureimplementation which is supplied by segments, 'ColumnCapabilities', which is available at a higher layer and provides the method 'hasMultipleValues'.- See Also:
-
LONG
Druid 64-bit integer number primitive type. Values will be represented as Java long orLong.- See Also:
-
DOUBLE
Druid 64-bit double precision floating point number primitive type. Values will be represented as Java double orDouble.- See Also:
-
FLOAT
Druid 32-bit single precision floating point number primitive type. Values will be represented as Java float orFloat.- See Also:
-
STRING_ARRAY
An array of Strings. Values will be represented as Object[]- See Also:
-
LONG_ARRAY
An array of Longs. Values will be represented as Object[] or long[]- See Also:
-
DOUBLE_ARRAY
An array of Doubles. Values will be represented as Object[] or double[].- See Also:
-
FLOAT_ARRAY
An array of Floats. Values will be represented as Object[] or float[].- See Also:
-
NESTED_DATA
-
UNKNOWN_COMPLEX
Placeholder type for an "unknown" complex, which is used when the complex type name was "lost" or unavailable for whatever reason, to indicate an opaque type that cannot be generically handled with normal complex type handling mechanisms. Prefer to use aColumnTypewith theBaseTypeSignature.complexTypeNameset for most complex type matters if at all possible.- See Also:
-
-
Constructor Details
-
ColumnType
public ColumnType(ValueType type, @Nullable String complexTypeName, @Nullable ColumnType elementType)
-
-
Method Details
-
fromString
-
fromCapabilities
-
ofArray
-
ofComplex
-
leastRestrictiveType
@Nullable public static ColumnType leastRestrictiveType(@Nullable ColumnType type, @Nullable ColumnType other) throws Types.IncompatibleTypeException Finds the type that can best represent both types, or none if there is no type information. If either type is null, the other type is returned. If both types are null, this method returns null as we cannot determine any useful type information. If the types areValueType.COMPLEX, they must be the same complex type, else this function throws aIllegalArgumentExceptionas the types are truly incompatible, with the exception ofNESTED_DATAwhich is complex and represents nested AND mixed type data so is instead treated as the 'least restrictive type' if present. If both types areValueType.ARRAY, the result is an array of the result of calling this method again onBaseTypeSignature.elementType. If only one type is an array, the result is an array type of calling this method on the non-array type and the array element type. After arrays, if either type isValueType.STRING, the result isValueType.STRING. If both types are numeric, then the result will beValueType.LONGif both are longs,ValueType.FLOATif both are floats, elseValueType.DOUBLE. -
leastRestrictiveType
-
getCacheKey
public byte[] getCacheKey()Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- bytes to be used as cache key - or null if this object should not be cached.
-