@Override public void initialize(BatchRuntimeContext context) throws Exception { super.initialize(context); }
@Override public void initialize(BatchRuntimeContext context) throws Exception { super.initialize(context); if (config.schema != null) { // should never happen, just done to test App correctness in unit tests Schema outputSchema = Schema.parseJson(config.schema); if (!outputSchema.equals(context.getOutputSchema())) { throw new IllegalStateException("Output schema does not match what was set at configure time."); } } }
@Override public Iterable<RecordInfo<Object>> call(Tuple2<Object, Object> input) throws Exception { if (transform == null) { BatchSource<Object, Object, Object> batchSource = pluginFunctionContext.createPlugin(); batchSource.initialize(pluginFunctionContext.createBatchRuntimeContext()); transform = new TrackedTransform<>(pluginFunctionContext.getDataTracer().isEnabled() ? new LimitingTransform<>(batchSource, numOfRecordsPreview) : batchSource, pluginFunctionContext.createStageMetrics(), pluginFunctionContext.getDataTracer(), pluginFunctionContext.getStageStatisticsCollector()); emitter = new CombinedEmitter<>(pluginFunctionContext.getStageName()); } emitter.reset(); KeyValue<Object, Object> inputKV = new KeyValue<>(input._1(), input._2()); transform.transform(inputKV, emitter); return emitter.getEmitted(); } }