Class AggSpecUnique

java.lang.Object
io.deephaven.api.agg.spec.AggSpecBase
io.deephaven.api.agg.spec.AggSpecUnique
All Implemented Interfaces:
AggSpec

@Immutable public abstract class AggSpecUnique extends AggSpecBase
Specifies an aggregation that outputs the single unique input value for groups that have one, null if all input values are null, or nonUniqueSentinel() if there is more than one distinct value.
  • Field Details

    • INCLUDE_NULLS_DEFAULT

      public static final boolean INCLUDE_NULLS_DEFAULT
      See Also:
  • Constructor Details

    • AggSpecUnique

      public AggSpecUnique()
  • Method Details

    • of

      public static AggSpecUnique of()
      Specify a "unique" aggregation that does not treat null as a value for purposes of determining if the values in a group are unique. If a group is non-empty but contains only null values, its result will be null. If a group contains more than a single unique value, its result will also be null.
      Returns:
      The "unique" aggregation specification
    • of

      public static AggSpecUnique of(boolean includeNulls, Object nonUniqueSentinel)
      Equivalent to of(includeNulls, UnionObject.from(nonUniqueSentinel)).
      Parameters:
      includeNulls - Whether null is treated as a value for determining if the values in a group are unique
      nonUniqueSentinel - Sentinel value to use if a group contains more than a single unique value
      Returns:
      The "unique" aggregation specification
      See Also:
    • of

      public static AggSpecUnique of(boolean includeNulls, UnionObject nonUniqueSentinel)
      Specify a "unique" aggregation that optionally treats null as a value for purposes of determining if the values in a group are unique. If a group is non-empty but contains only null values, its result will be null. If a group contains more than a single unique value, its result will be nonUniqueSentinel.
      Parameters:
      includeNulls - Whether null is treated as a value for determining if the values in a group are unique
      nonUniqueSentinel - Sentinel value to use if a group contains more than a single unique value
      Returns:
      The "unique" aggregation specification
    • description

      public final String description()
      Description copied from interface: AggSpec
      Get a simple description for this AggSpec.
      Returns:
      The description
    • includeNulls

      @Default public boolean includeNulls()
      Whether to include null values as a distinct value for determining if there is only one unique value to output.
      Returns:
      Whether to include nulls
    • nonUniqueSentinel

      public abstract Optional<UnionObject> nonUniqueSentinel()
      The output value to use for groups that don't have a single unique input value.
      Returns:
      The non-unique sentinel value
    • walk

      public final <V extends AggSpec.Visitor> V walk(V visitor)
      Description copied from interface: AggSpec
      Glue method to deliver this AggSpec to a AggSpec.Visitor.
      Parameters:
      visitor - The visitor
      Returns:
      The visitor