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 - 2025 Weber Informatics LLC | Privacy Policy