Package org.apache.druid.segment.column
Enum ValueType
- java.lang.Object
-
- java.lang.Enum<ValueType>
-
- org.apache.druid.segment.column.ValueType
-
- All Implemented Interfaces:
Serializable
,Comparable<ValueType>
,TypeDescriptor
public enum ValueType extends Enum<ValueType> implements TypeDescriptor
This enumeration defines the high level classification of the Druid type system, used byColumnType
to indicate the type of data stored in columns and produced by expressions and aggregations, used to allow query processing engine algorithms to compute results, used to compute query result row signatures, and all other type needs. Currently, only the primitive types (isPrimitive()
is true) andCOMPLEX
can be stored in columns and are also the only types handled directly by the query engines. Array types can currently be produced by expressions and by some post-aggregators, but do not currently have special engine handling, and should be used by implementors sparingly until full engine support is in place. Aggregators should never specify array types as their output type until the engines fully support these types.- See Also:
ColumnType
,TypeSignature
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ARRAY
Placeholder for arbitrary arrays of otherValueType
.COMPLEX
Placeholder for arbitrary 'complex' types, which have a corresponding serializer/deserializer implementation.DOUBLE
64-bit double precision floating point number primitive type.FLOAT
32-bit single precision floating point number primitive type.LONG
64-bit integer number primitve type.STRING
String object type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ValueType
fromString(String name)
boolean
isArray()
Type is an array typestatic boolean
isArray(ValueType type)
boolean
isNumeric()
Type is a numeric type, not including numeric array typesstatic boolean
isNumeric(ValueType type)
boolean
isPrimitive()
Type is a 'primitive' type, which includes theisNumeric()
types andSTRING
, but notCOMPLEX
orARRAY
types.static ValueType
valueOf(String name)
Returns the enum constant of this type with the specified name.static ValueType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DOUBLE
public static final ValueType DOUBLE
64-bit double precision floating point number primitive type. This type may be used as a grouping key, or as an input to any aggregators which support primitive numerical operations like sums, minimums, maximums, etc, as well as an input to expression virtual columns.
-
FLOAT
public static final ValueType FLOAT
32-bit single precision floating point number primitive type. This type may be used as a grouping key, or as an input to any aggregators which support primitive numerical operations like sums, minimums, maximums, etc, as well as an input to expression virtual columns.
-
LONG
public static final ValueType LONG
64-bit integer number primitve type. This type may be used as a grouping key, or as an input to any aggregators which support primitive numerical operations like sums, minimums, maximums, etc, as well as an input to expression virtual columns.
-
STRING
public static final ValueType STRING
String object type. This type may be used as a grouping key, an input to certain types of complex sketch aggregators, and as an input to expression virtual columns. String types might potentially be 'multi-valued' when stored in segments, and contextually at various layers of query processing, but this information is not available at this level. Strings are typically represented asString
. Multi-value strings appear asList
when necessary to represent multiple values, and can vary between string and list from one row to the next.
-
COMPLEX
public static final ValueType COMPLEX
Placeholder for arbitrary 'complex' types, which have a corresponding serializer/deserializer implementation. Note that knowing a type is complex alone isn't enough information to work with it directly, and additional information in the form of a type name which must be registered in the complex type registry. Complex types are not currently supported as a grouping key for aggregations. Complex types can be used as inputs to aggregators, in cases where the specific aggregator supports the specific complex type. Filtering on these types with standard filters is not well supported, and will be treated as null values. These types are represented by the individual Java type associated with the complex type name as defined in the type registry.
-
ARRAY
public static final ValueType ARRAY
Placeholder for arbitrary arrays of otherValueType
. This type has limited support as a grouping key for aggregations, ARRAY of STRING, LONG, DOUBLE, and FLOAT are supported, but ARRAY types in general are not. ARRAY types cannot be used as an input for numerical primitive aggregations such as sums, and have limited support as an input among complex type sketch aggregators. There are currently no native ARRAY typed columns, but they may be produced by expression virtual columns, aggregators, and post-aggregators. Arrays are represented as Object[], long[], double[], or float[]. The preferred type is Object[], since the expression system is the main consumer of arrays, and the expression system uses Object[] internally. Some code represents arrays in other ways; in particular the groupBy engine and SQL result layer. Over time we expect these usages to migrate to Object[], long[], double[], and float[].
-
-
Method Detail
-
values
public static ValueType[] 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 (ValueType c : ValueType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ValueType 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
-
isNumeric
public boolean isNumeric()
Type is a numeric type, not including numeric array types- Specified by:
isNumeric
in interfaceTypeDescriptor
- See Also:
isNumeric()
,ExprType.isNumeric()
-
isArray
public boolean isArray()
Type is an array type- Specified by:
isArray
in interfaceTypeDescriptor
- See Also:
isArray()
,ExprType.isArray()
-
isPrimitive
public boolean isPrimitive()
Type is a 'primitive' type, which includes theisNumeric()
types andSTRING
, but notCOMPLEX
orARRAY
types. Primitive types support being used for grouping to compute aggregates in both group by and top-n query engines, while non-primitive types currently do not.- Specified by:
isPrimitive
in interfaceTypeDescriptor
- See Also:
isPrimitive()
,ExprType.isPrimitive()
-
isNumeric
public static boolean isNumeric(ValueType type)
-
isArray
public static boolean isArray(ValueType type)
-
-