Record Class Aggregation

java.lang.Object
java.lang.Record
io.krabka.streams.columnar.Aggregation
Record Components:
inputColumn - the payload column the function reads
outputColumn - the name of the aggregate column in the output batch
function - the aggregate function to apply
outputType - the Arrow type of the output column, or null for the default

public record Aggregation(String inputColumn, String outputColumn, AggregateFunction function, org.apache.arrow.vector.types.pojo.ArrowType outputType) extends Record
Defines one aggregation, with an optional explicit output type.

Without an explicit type, AggregateFunction.COUNT outputs a signed 64-bit integer and the other functions keep the input column's type. Pass an ArrowType to override, for example to widen a 32-bit sum column to 64 bits.

Example

var wideTotal = new Aggregation(
    "amount", "total", AggregateFunction.SUM, new ArrowType.Int(64, true));
var op = BuiltinOp.groupBy(allocator, List.of("user"), wideTotal);
  • Constructor Details

    • Aggregation

      public Aggregation(String inputColumn, String outputColumn, AggregateFunction function)
      Creates an aggregation with the function's default output type.
      Parameters:
      inputColumn - the payload column the function reads
      outputColumn - the name of the aggregate column in the output batch
      function - the aggregate function to apply
    • Aggregation

      public Aggregation(String inputColumn, String outputColumn, AggregateFunction function, org.apache.arrow.vector.types.pojo.ArrowType outputType)
      Validates that everything but the output type is present.
      Parameters:
      inputColumn - the payload column the function reads
      outputColumn - the name of the aggregate column in the output batch
      function - the aggregate function to apply
      outputType - the Arrow type of the output column, or null for the default
      Throws:
      NullPointerException - if inputColumn, outputColumn, or function is null
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • inputColumn

      public String inputColumn()
      Returns the value of the inputColumn record component.
      Returns:
      the value of the inputColumn record component
    • outputColumn

      public String outputColumn()
      Returns the value of the outputColumn record component.
      Returns:
      the value of the outputColumn record component
    • function

      public AggregateFunction function()
      Returns the value of the function record component.
      Returns:
      the value of the function record component
    • outputType

      public org.apache.arrow.vector.types.pojo.ArrowType outputType()
      Returns the value of the outputType record component.
      Returns:
      the value of the outputType record component