java.lang.Object
com.northconcepts.datapipeline.group.GroupOperation<ArrayValue>
com.northconcepts.datapipeline.group.operation.GroupCollect

public class GroupCollect extends GroupOperation<ArrayValue>
Collects the individual values into an array. Supports options for collecting distinct values, flattening array values, and excluding nulls.
See Also:
  • Constructor Details

    • GroupCollect

      public GroupCollect(String sourceFieldName)
      Creates a GroupCollect operation for the specified source field.
      Parameters:
      sourceFieldName - the name of the source field to collect values from
    • GroupCollect

      public GroupCollect(FieldPath sourceFieldName)
      Creates a GroupCollect operation for the specified source field path.
      Parameters:
      sourceFieldName - the path of the source field to collect values from
    • GroupCollect

      public GroupCollect(String sourceFieldName, String targetFieldName)
      Creates a GroupCollect operation with source and target field names.
      Parameters:
      sourceFieldName - the name of the source field to collect values from
      targetFieldName - the name of the target field where the array will be placed
    • GroupCollect

      public GroupCollect(FieldPath sourceFieldName, FieldPath targetFieldName)
      Creates a GroupCollect operation with source and target field paths.
      Parameters:
      sourceFieldName - the path of the source field to collect values from
      targetFieldName - the path of the target field where the array will be placed
    • GroupCollect

      public GroupCollect(String sourceFieldName, String targetFieldName, boolean excludeNulls)
      Creates a GroupCollect operation with source and target field names and null exclusion option.
      Parameters:
      sourceFieldName - the name of the source field to collect values from
      targetFieldName - the name of the target field where the array will be placed
      excludeNulls - true to exclude null values from the collection, false to include them
    • GroupCollect

      public GroupCollect(FieldPath sourceFieldName, FieldPath targetFieldName, boolean excludeNulls)
      Creates a GroupCollect operation with source and target field paths and null exclusion option.
      Parameters:
      sourceFieldName - the path of the source field to collect values from
      targetFieldName - the path of the target field where the array will be placed
      excludeNulls - true to exclude null values from the collection, false to include them
  • Method Details

    • isDistinctValues

      public boolean isDistinctValues()
      Returns whether only distinct values are collected. When true, duplicate values are excluded from the collection.
      Returns:
      true if collecting only distinct values, false otherwise
    • setDistinctValues

      public GroupCollect setDistinctValues(boolean distinctValues)
      Sets whether only distinct values should be collected.
      Parameters:
      distinctValues - true to collect only distinct values, false to allow duplicates
      Returns:
      this GroupCollect instance for method chaining
    • isFlattenArrayValues

      public boolean isFlattenArrayValues()
      Returns whether array values should be flattened during collection. When true, array elements are added individually instead of as nested arrays.
      Returns:
      true if flattening array values, false otherwise
    • setFlattenArrayValues

      public GroupCollect setFlattenArrayValues(boolean flattenArrayValues)
      Sets whether array values should be flattened during collection.
      Parameters:
      flattenArrayValues - true to flatten array values, false to keep them nested
      Returns:
      this GroupCollect instance for method chaining
    • createField

      protected GroupOperationField<ArrayValue> createField()
      Description copied from class: GroupOperation
      Creates the accumulator that computes this operation's result for one group; called once per group in each window.
      Specified by:
      createField in class GroupOperation<ArrayValue>
    • toString

      public String toString()
      Overrides:
      toString in class GroupOperation<ArrayValue>