Source:
<code>public DataSet<V> join(OperationContext context, DataSet<V> rightDataSet, JoinType joinType, boolean isBroadcast) { try { JoinOperation op = (JoinOperation) context.getOperation(); Dataset<Row> leftDF = SpliceSpark.getSession().createDataFrame( rdd.map(new LocatedRowToRowFunction()), context.getOperation().getLeftOperation().getExecRowDefinition().schema()); Dataset<Row> rightDF = SpliceSpark.getSession().createDataFrame( ((SparkDataSet)rightDataSet).rdd.map(new LocatedRowToRowFunction()), context.getOperation().getRightOperation().getExecRowDefinition().schema()); if (isBroadcast) { rightDF = broadcast(rightDF); } Column expr = null; int[] rightJoinKeys = ((JoinOperation)context.getOperation()).getRightHashKeys(); int[] leftJoinKeys = ((JoinOperation)context.getOperation()).getLeftHashKeys(); assert rightJoinKeys!=null && leftJoinKeys!=null && rightJoinKeys.length == leftJoinKeys.length:"Join Keys Have Issues"; for (int i = 0; i< rightJoinKeys.length;i++) { Column joinEquality = (leftDF.col(ValueRow.getNamedColumn(leftJoinKeys[i])) .equalTo(rightDF.col(ValueRow.getNamedColumn(rightJoinKeys[i])))); expr = i!=0?expr.and(joinEquality):joinEquality; } DataSet joinedSet; if (op.wasRightOuterJoin) joinedSet = new SparkDataSet(rightDF.join(leftDF,expr,"rightouter").rdd().toJavaRDD().map( new RowToLocatedRowFunction(context))); <START> else <END> joinedSet = new SparkDataSet(leftDF.join(rightDF,expr,joinType.strategy()).rdd().toJavaRDD().map( new RowToLocatedRowFunction(context))); return joinedSet; } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>joinType.RIGHTOUTER</technical_language>

Target:
public DataSet<V> join(OperationContext context, DataSet<V> rightDataSet, JoinType joinType, boolean isBroadcast) { try { JoinOperation op = (JoinOperation) context.getOperation(); Dataset<Row> leftDF = SpliceSpark.getSession().createDataFrame( rdd.map(new LocatedRowToRowFunction()), context.getOperation().getLeftOperation().getExecRowDefinition().schema()); Dataset<Row> rightDF = SpliceSpark.getSession().createDataFrame( ((SparkDataSet)rightDataSet).rdd.map(new LocatedRowToRowFunction()), context.getOperation().getRightOperation().getExecRowDefinition().schema()); if (isBroadcast) { rightDF = broadcast(rightDF); } Column expr = null; int[] rightJoinKeys = ((JoinOperation)context.getOperation()).getRightHashKeys(); int[] leftJoinKeys = ((JoinOperation)context.getOperation()).getLeftHashKeys(); assert rightJoinKeys!=null && leftJoinKeys!=null && rightJoinKeys.length == leftJoinKeys.length:"Join Keys Have Issues"; for (int i = 0; i< rightJoinKeys.length;i++) { Column joinEquality = (leftDF.col(ValueRow.getNamedColumn(leftJoinKeys[i])) .equalTo(rightDF.col(ValueRow.getNamedColumn(rightJoinKeys[i])))); expr = i!=0?expr.and(joinEquality):joinEquality; } DataSet joinedSet; if (op.wasRightOuterJoin) joinedSet = new SparkDataSet(rightDF.join(leftDF,expr,joinType.RIGHTOUTER.strategy()).rdd().toJavaRDD().map( new RowToLocatedRowFunction(context))); else joinedSet = new SparkDataSet(leftDF.join(rightDF,expr,joinType.strategy()).rdd().toJavaRDD().map( new RowToLocatedRowFunction(context))); return joinedSet; } catch (Exception e) { throw new RuntimeException(e); } }