コード例 #1
0
  @Override
  protected List<OUT> executeOnCollections(
      List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
    MapFunction<IN, OUT> function = this.userFunction.getUserCodeObject();

    FunctionUtils.setFunctionRuntimeContext(function, ctx);
    FunctionUtils.openFunction(function, this.parameters);

    ArrayList<OUT> result = new ArrayList<OUT>(inputData.size());

    TypeSerializer<IN> inSerializer =
        getOperatorInfo().getInputType().createSerializer(executionConfig);
    TypeSerializer<OUT> outSerializer =
        getOperatorInfo().getOutputType().createSerializer(executionConfig);

    for (IN element : inputData) {
      IN inCopy = inSerializer.copy(element);
      OUT out = function.map(inCopy);
      result.add(outSerializer.copy(out));
    }

    FunctionUtils.closeFunction(function);

    return result;
  }
コード例 #2
0
ファイル: CoGroupedStreams.java プロジェクト: nguyent/flink
 @Override
 public TaggedUnion<T1, T2> copy(TaggedUnion<T1, T2> from, TaggedUnion<T1, T2> reuse) {
   if (from.isOne()) {
     return TaggedUnion.one(oneSerializer.copy(from.getOne()));
   } else {
     return TaggedUnion.two(twoSerializer.copy(from.getTwo()));
   }
 }
コード例 #3
0
ファイル: CoGroupedStreams.java プロジェクト: nguyent/flink
 @Override
 public void copy(DataInputView source, DataOutputView target) throws IOException {
   byte tag = source.readByte();
   target.writeByte(tag);
   if (tag == 1) {
     oneSerializer.copy(source, target);
   } else {
     twoSerializer.copy(source, target);
   }
 }
コード例 #4
0
  @Override
  public void copy(DataInputView source, DataOutputView target) throws IOException {
    int len = source.readInt();
    target.writeInt(len);

    for (int i = 0; i < len; i++) {
      boolean isNonNull = source.readBoolean();
      target.writeBoolean(isNonNull);

      if (isNonNull) {
        componentSerializer.copy(source, target);
      }
    }
  }
コード例 #5
0
 protected IN copy(IN record) {
   return objectSerializer.copy(record);
 }
コード例 #6
0
 @Override
 public StreamRecord<T> copy(StreamRecord<T> from, StreamRecord<T> reuse) {
   reuse.replace(typeSerializer.copy(from.getValue(), reuse.getValue()), 0);
   return reuse;
 }
コード例 #7
0
 @Override
 public StreamRecord<T> copy(StreamRecord<T> from) {
   return new StreamRecord<T>(typeSerializer.copy(from.getValue()), from.getTimestamp());
 }
コード例 #8
0
 @Override
 public void copy(DataInputView source, DataOutputView target) throws IOException {
   typeSerializer.copy(source, target);
 }