Record Class DerivedColumn

java.lang.Object
java.lang.Record
io.krabka.streams.columnar.DerivedColumn
Record Components:
field - the Arrow field declaring the column's name, type, and nullability
value - the function that computes the column's value for each row

public record DerivedColumn(org.apache.arrow.vector.types.pojo.Field field, RowValue value) extends Record
Defines a column that a with-columns operator adds or replaces.

A derived column whose field name matches an existing payload column replaces it in place, keeping its position; a new name is appended after the existing columns. Reserved metadata names such as __timestamp are rejected when the operator is constructed.

Example

var doubled = new DerivedColumn(
    new Field("double_amount", FieldType.nullable(new ArrowType.Int(64, true)), null),
    (batch, row) -> ((BigIntVector) batch.getVector("amount")).get(row) * 2);
var op = BuiltinOp.withColumns(allocator, doubled);
  • Constructor Summary

    Constructors
    Constructor
    Description
    DerivedColumn(org.apache.arrow.vector.types.pojo.Field field, RowValue value)
    Validates that both components are present.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    org.apache.arrow.vector.types.pojo.Field
    Returns the value of the field record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    Returns the value of the value record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DerivedColumn

      public DerivedColumn(org.apache.arrow.vector.types.pojo.Field field, RowValue value)
      Validates that both components are present.
      Parameters:
      field - the Arrow field declaring the column's name, type, and nullability
      value - the function that computes the column's value for each row
      Throws:
      NullPointerException - if field or value 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.
    • field

      public org.apache.arrow.vector.types.pojo.Field field()
      Returns the value of the field record component.
      Returns:
      the value of the field record component
    • value

      public RowValue value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component