/** * Configures the pipeline based on the directives. It parses the recipe, * converting it into executable directives. * * @param parser Wrangle directives parser. */ @Override public void initialize(RecipeParser parser, ExecutorContext context) throws RecipeException { this.context = context; try { this.directives = parser.parse(); } catch (DirectiveParseException e) { throw new RecipeException(e.getMessage()); } catch (DirectiveNotFoundException | DirectiveLoadException e) { throw new RecipeException(e.getMessage(), e); } }
/** * Executes the pipeline on the input. * * @param rows List of Input record of type I. * @param schema Schema to which the output should be mapped. * @return Parsed output list of record of type O */ @Override public List<StructuredRecord> execute(List<Row> rows, Schema schema) throws RecipeException { rows = execute(rows); try { List<StructuredRecord> output = convertor.toStructureRecord(rows, schema); return output; } catch (RecordConvertorException e) { throw new RecipeException("Problem converting into output record. Reason : " + e.getMessage()); } }
throw new RecipeException(e.getMessage(), e);