Search in sources :

Example 1 with DynamicDriverContext

use of io.cdap.cdap.etl.spark.streaming.DynamicDriverContext in project cdap by caskdata.

the class SparkStreamingPipelineRunner method mergeJoinResults.

@Override
protected SparkCollection<Object> mergeJoinResults(StageSpec stageSpec, FunctionCache.Factory functionCacheFactory, SparkPairCollection<Object, List<JoinElement<Object>>> joinedInputs, StageStatisticsCollector collector) throws Exception {
    DynamicDriverContext dynamicDriverContext = new DynamicDriverContext(stageSpec, sec, collector);
    JavaPairDStream<Object, List<JoinElement<Object>>> pairDStream = joinedInputs.getUnderlying();
    JavaDStream<Object> result = pairDStream.transform(new DynamicJoinMerge<>(dynamicDriverContext, functionCacheFactory.newCache()));
    return new DStreamCollection<>(sec, functionCacheFactory, result);
}
Also used : DStreamCollection(io.cdap.cdap.etl.spark.streaming.DStreamCollection) PairDStreamCollection(io.cdap.cdap.etl.spark.streaming.PairDStreamCollection) List(java.util.List) DynamicDriverContext(io.cdap.cdap.etl.spark.streaming.DynamicDriverContext)

Example 2 with DynamicDriverContext

use of io.cdap.cdap.etl.spark.streaming.DynamicDriverContext in project cdap by caskdata.

the class SparkStreamingPipelineRunner method addJoinKey.

@Override
protected SparkPairCollection<Object, Object> addJoinKey(StageSpec stageSpec, FunctionCache.Factory functionCacheFactory, String inputStageName, SparkCollection<Object> inputCollection, StageStatisticsCollector collector) throws Exception {
    DynamicDriverContext dynamicDriverContext = new DynamicDriverContext(stageSpec, sec, collector);
    JavaDStream<Object> dStream = inputCollection.getUnderlying();
    JavaPairDStream<Object, Object> result = dStream.transformToPair(new DynamicJoinOn<>(dynamicDriverContext, functionCacheFactory.newCache(), inputStageName));
    return new PairDStreamCollection<>(sec, functionCacheFactory, result);
}
Also used : PairDStreamCollection(io.cdap.cdap.etl.spark.streaming.PairDStreamCollection) DynamicDriverContext(io.cdap.cdap.etl.spark.streaming.DynamicDriverContext)

Aggregations

DynamicDriverContext (io.cdap.cdap.etl.spark.streaming.DynamicDriverContext)2 PairDStreamCollection (io.cdap.cdap.etl.spark.streaming.PairDStreamCollection)2 DStreamCollection (io.cdap.cdap.etl.spark.streaming.DStreamCollection)1 List (java.util.List)1