@Override public void transform(KeyValue<NullWritable, StructuredRecord> input, Emitter<StructuredRecord> emitter) { emitter.emit(input.getValue()); } }
@Override public Tuple2<OUT_KEY, OUT_VAL> apply(KeyValue<OUT_KEY, OUT_VAL> input) { return new Tuple2<>(input.getKey(), input.getValue()); } });
@Override public void transform(KeyValue<NullWritable, StructuredRecord> input, Emitter<StructuredRecord> emitter) { emitter.emit(input.getValue()); } }
@Override public void transform(KeyValue<NullWritable, StructuredRecord> input, Emitter<StructuredRecord> emitter) throws Exception { emitter.emit(input.getValue()); }
@Override public void transform(KeyValue<LongWritable, Text> input, Emitter<StructuredRecord> emitter) throws Exception { emitter.emit(GSON.fromJson(input.getValue().toString(), StructuredRecord.class)); }
/** * Transform the {@link KeyValue} pair produced by the input, as set in {@link BatchSource#prepareRun}, * to a single object and emit it to the next stage. By default it emits the value. * This method is invoked inside the Batch run. * * @param input the input to transform * @param emitter {@link Emitter} to emit data to the next stage * @throws Exception if there's an error during this method invocation */ @Override public void transform(KeyValue<KEY_IN, VAL_IN> input, Emitter<OUT> emitter) throws Exception { emitter.emit((OUT) input.getValue()); }
@Override public void transform(KeyValue<NullWritable, StructuredRecord> input, Emitter<StructuredRecord> emitter) { emitter.emit(input.getValue()); }
@Override public void transform(KeyValue<NullWritable, StructuredRecord> input, Emitter<StructuredRecord> emitter) { emitter.emit(input.getValue()); }
@Override public void write(NullWritable key, StructuredRecord value) throws IOException, InterruptedException { KeyValue<K, V> converted = conversion.apply(value); delegate.write(converted.getKey(), converted.getValue()); }
@Override public void transform(KeyValue<byte[], Row> input, Emitter<StructuredRecord> emitter) throws Exception { emitter.emit(rowRecordTransformer.toRecord(input.getValue())); } }
@Override public void write(String sinkName, KeyValue<KEY_OUT, VAL_OUT> output) throws Exception { context.write(output.getKey(), output.getValue()); } }
@Override public void write(String sinkName, KeyValue<KEY_OUT, VAL_OUT> output) throws Exception { for (String outputName : sinkOutputs.get(sinkName).getSinkOutputs()) { context.write(outputName, output.getKey(), output.getValue()); } } }
@Override public void transform(KeyValue<REDUCE_KEY, Iterator<REDUCE_VAL>> input, Emitter<OUT> emitter) throws Exception { GROUP_KEY groupKey = keyConversion.fromWritable(input.getKey()); Iterator<GROUP_VAL> iter = Iterators.transform(input.getValue(), new Function<REDUCE_VAL, GROUP_VAL>() { @Nullable @Override public GROUP_VAL apply(@Nullable REDUCE_VAL input) { return valConversion.fromWritable(input); } }); aggregator.aggregate(groupKey, iter, emitter); } }
@Override public void transform(KeyValue<byte[], Row> input, Emitter<StructuredRecord> emitter) throws Exception { Schema schema = Schema.parseJson(input.getValue().getString(SCHEMA_COL)); String recordStr = input.getValue().getString(RECORD_COL); emitter.emit(StructuredRecordStringConverter.fromJsonString(recordStr, schema)); }
@Override public void transform(KeyValue<byte[], Row> input, Emitter<StructuredRecord> emitter) throws Exception { Schema schema = Schema.parseJson(input.getValue().getString(SCHEMA_COL)); String recordStr = input.getValue().getString(RECORD_COL); emitter.emit(StructuredRecordStringConverter.fromJsonString(recordStr, schema)); }
@WriteOnly @Override public void write(KeyValue<byte[], byte[]> keyValue) throws IOException { write(keyValue.getKey(), keyValue.getValue()); }
@Override protected KeyValue<byte[], T> computeNext() { Preconditions.checkState(!closed); if (keyValueIterator.hasNext()) { KeyValue<byte[], byte[]> row = keyValueIterator.next(); return new KeyValue<>(row.getKey(), decode(row.getValue())); } close(); return null; }
@Override protected KeyValue<byte[], T> computeNext() { Preconditions.checkState(!closed); if (keyValueIterator.hasNext()) { KeyValue<byte[], byte[]> row = keyValueIterator.next(); return new KeyValue<>(row.getKey(), decode(row.getValue())); } close(); return null; }
@Override public void apply() throws Exception { records.write(record.getKey(), record.getValue()); } });
@Override public void transform(KeyValue<byte[], byte[]> input, Emitter<StructuredRecord> emitter) throws Exception { emitter.emit(StructuredRecord.builder(SCHEMA).set("key", input.getKey()).set("value", input.getValue()).build()); } }