All Known Implementing Classes:
ArrayValue, BooleanValue, DateValue, DurationValue, NullValue, NumberValue, StringValue, StructValue, TimestampValue, TimeValue

A runtime scalar value produced or consumed during query execution.

The sealed hierarchy maps directly onto the type lattice in ScalarType:

Pattern matching over the sealed subtypes is the preferred way to dispatch on value kind:


 String display = switch (value) {
     case StringValue  s -> s.value();
     case NumberValue  n -> n.value().toPlainString();
     case BooleanValue b -> String.valueOf(b.value());
     case NullValue    n -> "NULL";
     default           -> value.asDisplayString();
 };
 

A switch that names every subtype needs no default and will not compile once a new one is added — which is the point of sealing the hierarchy.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a human-readable display string for this value, suitable for output formatting.
    boolean
    Returns true if this value is null (absent).
    Returns the ScalarType that describes this value's kind.
  • Method Details

    • isNull

      boolean isNull()
      Returns true if this value is null (absent).
      Returns:
      whether this is a NullValue
    • type

      ScalarType type()
      Returns the ScalarType that describes this value's kind. NullValue returns ScalarType.ANY.
      Returns:
      the scalar type
    • asDisplayString

      String asDisplayString()
      Returns a human-readable display string for this value, suitable for output formatting. NullValue returns "NULL".
      Returns:
      display string; never null