use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter in project Gaffer by gchq.
the class ImportJavaRDDOfElementsHandler method doOperation.
public void doOperation(final ImportJavaRDDOfElements operation, final Context context, final AccumuloStore store) throws OperationException {
final String outputPath = operation.getOption(OUTPUT_PATH);
if (null == outputPath || outputPath.isEmpty()) {
throw new OperationException("Option outputPath must be set for this option to be run against the accumulostore");
}
final String failurePath = operation.getOption(FAILURE_PATH);
if (null == failurePath || failurePath.isEmpty()) {
throw new OperationException("Option failurePath must be set for this option to be run against the accumulostore");
}
final Broadcast<AccumuloElementConverter> broadcast = operation.getJavaSparkContext().broadcast(store.getKeyPackage().getKeyConverter());
final ElementConverterFunction func = new ElementConverterFunction(broadcast);
final JavaPairRDD<Key, Value> rdd = operation.getInput().flatMapToPair(func);
final ImportKeyValueJavaPairRDDToAccumulo op = new ImportKeyValueJavaPairRDDToAccumulo.Builder().input(rdd).failurePath(failurePath).outputPath(outputPath).build();
store._execute(new OperationChain<>(op), context);
}
Aggregations