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

io.ray.streaming.operator.impl.FlatMapOperator Maven / Gradle / Ivy

package io.ray.streaming.operator.impl;

import io.ray.streaming.api.collector.CollectionCollector;
import io.ray.streaming.api.collector.Collector;
import io.ray.streaming.api.context.RuntimeContext;
import io.ray.streaming.api.function.impl.FlatMapFunction;
import io.ray.streaming.message.Record;
import io.ray.streaming.operator.OneInputOperator;
import io.ray.streaming.operator.StreamOperator;
import java.util.List;

public class FlatMapOperator extends StreamOperator>
    implements OneInputOperator {

  private CollectionCollector collectionCollector;

  public FlatMapOperator(FlatMapFunction flatMapFunction) {
    super(flatMapFunction);
  }

  @Override
  public void open(List collectorList, RuntimeContext runtimeContext) {
    super.open(collectorList, runtimeContext);
    this.collectionCollector = new CollectionCollector(collectorList);
  }

  @Override
  public void processElement(Record record) throws Exception {
    this.function.flatMap(record.getValue(), (Collector) collectionCollector);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy