All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ray.streaming.api.partition.impl.BroadcastPartition Maven / Gradle / Ivy

package io.ray.streaming.api.partition.impl;

import io.ray.streaming.api.partition.Partition;
import java.util.stream.IntStream;

/** Broadcast the record to all downstream partitions. */
public class BroadcastPartition implements Partition {

  private int[] partitions = new int[0];

  public BroadcastPartition() {}

  @Override
  public int[] partition(T value, int numPartition) {
    if (partitions.length != numPartition) {
      partitions = IntStream.rangeClosed(0, numPartition - 1).toArray();
    }
    return partitions;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy