Examples of RuntimeUDFContext


Examples of org.apache.flink.api.common.functions.util.RuntimeUDFContext

   
    @SuppressWarnings("unchecked")
    SingleInputOperator<IN, OUT, ?> typedOp = (SingleInputOperator<IN, OUT, ?>) operator;
   
    // build the runtime context and compute broadcast variables, if necessary
    RuntimeUDFContext ctx;
    if (RichFunction.class.isAssignableFrom(typedOp.getUserCodeWrapper().getUserCodeClass())) {
      ctx = superStep == 0 ? new RuntimeUDFContext(operator.getName(), 1, 0, getClass().getClassLoader()) :
          new IterationRuntimeUDFContext(operator.getName(), 1, 0, superStep, classLoader);
     
      for (Map.Entry<String, Operator<?>> bcInputs : operator.getBroadcastInputs().entrySet()) {
        List<?> bcData = execute(bcInputs.getValue());
        ctx.setBroadcastVariable(bcInputs.getKey(), bcData);
      }
    } else {
      ctx = null;
    }
   
    List<OUT> result = typedOp.executeOnCollections(inputData, ctx, mutableObjectSafeMode);
   
    if (ctx != null) {
      AccumulatorHelper.mergeInto(this.accumulators, ctx.getAllAccumulators());
    }
    return result;
  }
View Full Code Here

Examples of org.apache.flink.api.common.functions.util.RuntimeUDFContext

   
    @SuppressWarnings("unchecked")
    DualInputOperator<IN1, IN2, OUT, ?> typedOp = (DualInputOperator<IN1, IN2, OUT, ?>) operator;
   
    // build the runtime context and compute broadcast variables, if necessary
    RuntimeUDFContext ctx;
    if (RichFunction.class.isAssignableFrom(typedOp.getUserCodeWrapper().getUserCodeClass())) {
      ctx = superStep == 0 ? new RuntimeUDFContext(operator.getName(), 1, 0, classLoader) :
        new IterationRuntimeUDFContext(operator.getName(), 1, 0, superStep, classLoader);
     
      for (Map.Entry<String, Operator<?>> bcInputs : operator.getBroadcastInputs().entrySet()) {
        List<?> bcData = execute(bcInputs.getValue());
        ctx.setBroadcastVariable(bcInputs.getKey(), bcData);
      }
    } else {
      ctx = null;
    }
   
    List<OUT> result = typedOp.executeOnCollections(inputData1, inputData2, ctx, mutableObjectSafeMode);
   
    if (ctx != null) {
      AccumulatorHelper.mergeInto(this.accumulators, ctx.getAllAccumulators());
    }
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.