Examples of RichFunction


Examples of org.apache.flink.api.common.functions.RichFunction

public class FunctionUtils {

  public static void openFunction (Function function, Configuration parameters) throws Exception{
    if (function instanceof RichFunction) {
      RichFunction richFunction = (RichFunction) function;
      richFunction.open (parameters);
    }
  }
View Full Code Here

Examples of org.apache.flink.api.common.functions.RichFunction

    }
  }

  public static void closeFunction (Function function) throws Exception{
    if (function instanceof RichFunction) {
      RichFunction richFunction = (RichFunction) function;
      richFunction.close ();
    }
  }
View Full Code Here

Examples of org.apache.flink.api.common.functions.RichFunction

    }
  }

  public static void setFunctionRuntimeContext (Function function, RuntimeContext context){
    if (function instanceof RichFunction) {
      RichFunction richFunction = (RichFunction) function;
      richFunction.setRuntimeContext(context);
    }
  }
View Full Code Here

Examples of org.apache.flink.api.common.functions.RichFunction

    }
  }

  public static RuntimeContext getFunctionRuntimeContext (Function function, RuntimeContext defaultContext){
    if (function instanceof RichFunction) {
      RichFunction richFunction = (RichFunction) function;
      return richFunction.getRuntimeContext();
    }
    else {
      return defaultContext;
    }
  }
View Full Code Here

Examples of org.apache.flink.api.common.functions.RichFunction

    try {
      AtomicInteger methodCounter = new AtomicInteger();
     
      ReduceOperator reduceOp = ReduceOperator.builder(new TestReduceFunction(methodCounter)).build();
     
      RichFunction reducer = (RichFunction) reduceOp.getUserCodeWrapper().getUserCodeObject();
     
      // test the method invocations
      reducer.close();
      reducer.open(new Configuration());
      assertEquals(2, methodCounter.get());
     
      // prepare the reduce / combine tests
      final List<Record> target = new ArrayList<Record>();
      Collector<Record> collector = new Collector<Record>() {
View Full Code Here

Examples of org.apache.flink.api.common.functions.RichFunction

    try {
      AtomicInteger methodCounter = new AtomicInteger();
     
      CoGroupOperator coGroupOp = CoGroupOperator.builder(new TestCoGroupFunction(methodCounter), LongValue.class, 1, 2).build();
     
      RichFunction cogrouper = (RichFunction) coGroupOp.getUserCodeWrapper().getUserCodeObject();
     
      // test the method invocations
      cogrouper.close();
      cogrouper.open(new Configuration());
      assertEquals(2, methodCounter.get());
     
      // prepare the coGroup
      final List<Record> target = new ArrayList<Record>();
      Collector<Record> collector = new Collector<Record>() {
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.