Search in sources :

Example 1 with DynamicDriverContext

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

the class SparkStreamingPipelineRunner method addJoinKey.

@Override
protected SparkPairCollection<Object, Object> addJoinKey(StageInfo stageInfo, String inputStageName, SparkCollection<Object> inputCollection) throws Exception {
    DynamicDriverContext dynamicDriverContext = new DynamicDriverContext(stageInfo, sec);
    JavaDStream<Object> dStream = inputCollection.getUnderlying();
    JavaPairDStream<Object, Object> result = dStream.transformToPair(new DynamicJoinOn<>(dynamicDriverContext, inputStageName));
    return new PairDStreamCollection<>(sec, result);
}
Also used : PairDStreamCollection(co.cask.cdap.etl.spark.streaming.PairDStreamCollection) DynamicDriverContext(co.cask.cdap.etl.spark.streaming.DynamicDriverContext)

Example 2 with DynamicDriverContext

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

the class SparkStreamingPipelineRunner method mergeJoinResults.

@Override
protected SparkCollection<Object> mergeJoinResults(StageInfo stageInfo, SparkPairCollection<Object, List<JoinElement<Object>>> joinedInputs) throws Exception {
    DynamicDriverContext dynamicDriverContext = new DynamicDriverContext(stageInfo, sec);
    JavaPairDStream<Object, List<JoinElement<Object>>> pairDStream = joinedInputs.getUnderlying();
    JavaDStream<Object> result = pairDStream.transform(new DynamicJoinMerge<>(dynamicDriverContext));
    return new DStreamCollection<>(sec, result);
}
Also used : PairDStreamCollection(co.cask.cdap.etl.spark.streaming.PairDStreamCollection) DStreamCollection(co.cask.cdap.etl.spark.streaming.DStreamCollection) List(java.util.List) DynamicDriverContext(co.cask.cdap.etl.spark.streaming.DynamicDriverContext)

Aggregations

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