Enum Class ValueType

java.lang.Object
java.lang.Enum<ValueType>
org.apache.druid.segment.column.ValueType
All Implemented Interfaces:
Serializable, Comparable<ValueType>, Constable, TypeDescriptor

@Immutable public enum ValueType extends Enum<ValueType> implements TypeDescriptor
This enumeration defines the high level classification of the Druid type system, used by ColumnType 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) and COMPLEX 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:
  • Enum Constant Details

    • 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 as String. Multi-value strings appear as List<String> 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 other ValueType. 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 Details

    • values

      public static ValueType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ValueType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • isNumeric

      public boolean isNumeric()
      Type is a numeric type, not including numeric array types
      Specified by:
      isNumeric in interface TypeDescriptor
      See Also:
    • isArray

      public boolean isArray()
      Type is an array type
      Specified by:
      isArray in interface TypeDescriptor
      See Also:
    • isPrimitive

      public boolean isPrimitive()
      Type is a 'primitive' type, which includes the isNumeric() types and STRING, but not COMPLEX or ARRAY 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 interface TypeDescriptor
      See Also:
    • fromString

      @Nullable public static ValueType fromString(@Nullable String name)
    • isNumeric

      public static boolean isNumeric(ValueType type)
    • isArray

      public static boolean isArray(ValueType type)