use of org.apache.flink.table.planner.runtime.utils.JavaUserDefinedScalarFunctions.PythonScalarFunction in project flink by apache.
the class PythonScalarFunctionOperatorTestBase method testPythonScalarFunctionOperatorIsChainedByDefault.
@Test
public void testPythonScalarFunctionOperatorIsChainedByDefault() {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
StreamTableEnvironment tEnv = createTableEnvironment(env);
tEnv.getConfig().getConfiguration().setString(TaskManagerOptions.TASK_OFF_HEAP_MEMORY.key(), "80mb");
tEnv.registerFunction("pyFunc", new PythonScalarFunction("pyFunc"));
DataStream<Tuple2<Integer, Integer>> ds = env.fromElements(new Tuple2<>(1, 2));
Table t = tEnv.fromDataStream(ds, $("a"), $("b")).select(call("pyFunc", $("a"), $("b")));
// force generating the physical plan for the given table
tEnv.toAppendStream(t, BasicTypeInfo.INT_TYPE_INFO);
JobGraph jobGraph = env.getStreamGraph().getJobGraph();
List<JobVertex> vertices = jobGraph.getVerticesSortedTopologicallyFromSources();
Assert.assertEquals(1, vertices.size());
}
Aggregations