Record Class ColumnarJoin

java.lang.Object
java.lang.Record
io.krabka.streams.columnar.ColumnarJoin
Record Components:
leftKey - the join key column in the left branch's batches
rightKey - the join key column in the right branch's batches
window - the maximum event-time distance between matching rows; zero joins only equal timestamps
leftPrefix - the prefix for left payload columns in the joined batch
rightPrefix - the prefix for right payload columns in the joined batch

public record ColumnarJoin(String leftKey, String rightKey, Duration window, String leftPrefix, String rightPrefix) extends Record
Configuration for an inner, event-time, equi-join.

Passed to ColumnarTopology.addJoin(String, ColumnarJoin, ColumnarNode, ColumnarNode). Two rows match when their key column values are equal and their __timestamp values differ by at most the window. The joined batch carries the left and right payload columns renamed with the prefixes, followed by the metadata columns of the left row.

Example

var join = new ColumnarJoin("order_id", "order_id", Duration.ofMinutes(5));
var joined = topology.addJoin("orders-with-payments", join, orders, payments);
  • Constructor Details

    • ColumnarJoin

      public ColumnarJoin(String leftKey, String rightKey, Duration window)
      Creates a join with the default left_ and right_ prefixes.
      Parameters:
      leftKey - the join key column in the left branch's batches
      rightKey - the join key column in the right branch's batches
      window - the maximum event-time distance between matching rows
    • ColumnarJoin

      public ColumnarJoin(String leftKey, String rightKey, Duration window, String leftPrefix, String rightPrefix)
      Validates the configuration.
      Parameters:
      leftKey - the join key column in the left branch's batches
      rightKey - the join key column in the right branch's batches
      window - the maximum event-time distance between matching rows
      leftPrefix - the prefix for left payload columns in the joined batch
      rightPrefix - the prefix for right payload columns in the joined batch
      Throws:
      NullPointerException - if any component is null
      IllegalArgumentException - if the window is negative or below one millisecond of precision
  • 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.
    • leftKey

      public String leftKey()
      Returns the value of the leftKey record component.
      Returns:
      the value of the leftKey record component
    • rightKey

      public String rightKey()
      Returns the value of the rightKey record component.
      Returns:
      the value of the rightKey record component
    • window

      public Duration window()
      Returns the value of the window record component.
      Returns:
      the value of the window record component
    • leftPrefix

      public String leftPrefix()
      Returns the value of the leftPrefix record component.
      Returns:
      the value of the leftPrefix record component
    • rightPrefix

      public String rightPrefix()
      Returns the value of the rightPrefix record component.
      Returns:
      the value of the rightPrefix record component