private void writeOutput() { Config plannerConfig = config.getConfig(PLANNER_TYPE); Planner planner = getPlanner(true); validatePlannerOutputCompatibility(planner, getOutput(false)); // Plan the mutations, and then apply them to the output, based on the type of planner used if (planner instanceof RandomPlanner) { RandomPlanner randomPlanner = (RandomPlanner)planner; List<String> keyFieldNames = randomPlanner.getKeyFieldNames(); Config outputConfig = config.getConfig(OUTPUT_TYPE); JavaRDD<Row> planned = planMutationsByKey(data, keyFieldNames, plannerConfig, outputConfig); applyMutations(planned, outputConfig); } else if (planner instanceof BulkPlanner) { BulkPlanner bulkPlanner = (BulkPlanner)planner; List<Tuple2<MutationType, Dataset<Row>>> planned = bulkPlanner.planMutationsForSet(data); BulkOutput bulkOutput = (BulkOutput)getOutput(true); bulkOutput.applyBulkMutations(planned); } else { throw new RuntimeException("Unexpected planner class: " + planner.getClass().getName()); } }