Examples of RuntimeUDFContext


Examples of eu.stratosphere.pact.runtime.udf.RuntimeUDFContext

    this.output = initOutputs(this, this.userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs);
  }

  public RuntimeUDFContext createRuntimeContext(String taskName) {
    Environment env = getEnvironment();
    return new RuntimeUDFContext(taskName, env.getCurrentNumberOfSubtasks(), env.getIndexInSubtaskGroup(), env.getCopyTask());
  }
View Full Code Here

Examples of eu.stratosphere.pact.runtime.udf.RuntimeUDFContext

   
    if (parent instanceof RegularPactTask) {
      this.udfContext = ((RegularPactTask<?, ?>) parent).createRuntimeContext(taskName);
    } else {
      Environment env = parent.getEnvironment();
      this.udfContext = new RuntimeUDFContext(taskName, env.getCurrentNumberOfSubtasks(), env.getIndexInSubtaskGroup(), env.getCopyTask());
    }

    setup(parent);
  }
View Full Code Here

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

    final List<String> inputData2 = new ArrayList<String>(Arrays.asList("foobar", "foo"));
    final List<Integer> expected = new ArrayList<Integer>(Arrays.asList(3, 3, 6, 6));


    try {
      List<Integer> resultSafe = base.executeOnCollections(inputData1, inputData2, new RuntimeUDFContext(taskName, 1, 0, null), true);
      List<Integer> resultRegular = base.executeOnCollections(inputData1, inputData2, new RuntimeUDFContext(taskName, 1, 0, null), false);

      assertEquals(expected, resultSafe);
      assertEquals(expected, resultRegular);
    }
    catch (Exception e) {
View Full Code Here

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

     
      MapOperatorBase<String, Integer, MapFunction<String, Integer>> op = new MapOperatorBase<String, Integer, MapFunction<String,Integer>>(
          parser, new UnaryOperatorInformation<String, Integer>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO), taskName);
     
      List<String> input = new ArrayList<String>(asList("1", "2", "3", "4", "5", "6"));
      List<Integer> resultMutableSafe = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), true);
      List<Integer> resultRegular = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), false);
     
      assertEquals(asList(1, 2, 3, 4, 5, 6), resultMutableSafe);
      assertEquals(asList(1, 2, 3, 4, 5, 6), resultRegular);
     
      assertTrue(opened.get());
View Full Code Here

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

  }

  private void testExecuteOnCollection(FlatMapFunction<String, String> udf, List<String> input, boolean mutableSafe) throws Exception {
    // run on collections
    final List<String> result = getTestFlatMapOperator(udf)
        .executeOnCollections(input, new RuntimeUDFContext("Test UDF", 4, 0, null), mutableSafe);

    Assert.assertEquals(input.size(), result.size());
    Assert.assertEquals(input, result);
  }
View Full Code Here

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

          new MapPartitionOperatorBase<String, Integer, MapPartitionFunction<String,Integer>>(
          parser, new UnaryOperatorInformation<String, Integer>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO), taskName);
     
      List<String> input = new ArrayList<String>(asList("1", "2", "3", "4", "5", "6"));
     
      List<Integer> resultMutableSafe = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), true);
      List<Integer> resultRegular = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), false);
     
      assertEquals(asList(1, 2, 3, 4, 5, 6), resultMutableSafe);
      assertEquals(asList(1, 2, 3, 4, 5, 6), resultRegular);
     
      assertTrue(opened.get());
View Full Code Here

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

        new Tuple2<Double, String>(3.0, "3"),
        new Tuple2<Double, String>(3.0, "4")
    ));

    try {
      List<Tuple2<Double, String>> resultSafe = base.executeOnCollections(inputData1, inputData2, new RuntimeUDFContext("op", 1, 0, null), true);
      List<Tuple2<Double, String>> resultRegular = base.executeOnCollections(inputData1, inputData2, new RuntimeUDFContext("op", 1, 0, null), false);

      assertEquals(expected, new HashSet<Tuple2<Double, String>>(resultSafe));
      assertEquals(expected, new HashSet<Tuple2<Double, String>>(resultRegular));
    }
    catch (Exception e) {
View Full Code Here

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

      List<Tuple2<String, Integer>> input = new ArrayList<Tuple2<String,
          Integer>>(asList(new Tuple2<String, Integer>("foo", 1), new Tuple2<String,
          Integer>("foo", 3), new Tuple2<String, Integer>("bar", 2), new Tuple2<String,
          Integer>("bar", 4)));

      List<Tuple2<String, Integer>> resultMutableSafe = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), true);
      List<Tuple2<String, Integer>> resultRegular = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), false);

      Set<Tuple2<String, Integer>> resultSetMutableSafe = new HashSet<Tuple2<String, Integer>>(resultMutableSafe);
      Set<Tuple2<String, Integer>> resultSetRegular = new HashSet<Tuple2<String, Integer>>(resultRegular);

      Set<Tuple2<String, Integer>> expectedResult = new HashSet<Tuple2<String,
View Full Code Here

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

      List<Tuple2<String, Integer>> input = new ArrayList<Tuple2<String,
          Integer>>(asList(new Tuple2<String, Integer>("foo", 1), new Tuple2<String,
          Integer>("foo", 3), new Tuple2<String, Integer>("bar", 2), new Tuple2<String,
          Integer>("bar", 4)));

      List<Tuple2<String, Integer>> resultMutableSafe = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), true);
      List<Tuple2<String, Integer>> resultRegular = op.executeOnCollections(input, new RuntimeUDFContext(taskName, 1, 0, null), false);
     
     
      Set<Tuple2<String, Integer>> resultSetMutableSafe = new HashSet<Tuple2<String, Integer>>(resultMutableSafe);
      Set<Tuple2<String, Integer>> resultSetRegular = new HashSet<Tuple2<String, Integer>>(resultRegular);
View Full Code Here

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

              .add("barfoo", 1)
              .add("foo", 1)
              .build()
      );

      final RuntimeContext ctx = new RuntimeUDFContext("Test UDF", 4, 0, null);

      {
        SumCoGroup udf1 = new SumCoGroup();
        SumCoGroup udf2 = new SumCoGroup();
       
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.