Search in sources :

Example 26 with GenericTypeInfo

use of org.apache.flink.api.java.typeutils.GenericTypeInfo in project flink by apache.

the class OuterJoinITCase method testJoinWithAtomicType1.

@Test
public void testJoinWithAtomicType1() throws Exception {
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<Tuple3<Integer, Long, String>> ds1 = CollectionDataSets.getSmall3TupleDataSet(env);
    DataSet<Integer> ds2 = env.fromElements(1, 2);
    DataSet<Tuple2<Tuple3<Integer, Long, String>, Integer>> joinDs = ds1.fullOuterJoin(ds2).where(0).equalTo("*").with(new ProjectBothFunction<Tuple3<Integer, Long, String>, Integer>()).returns(new GenericTypeInfo(Tuple2.class));
    List<Tuple2<Tuple3<Integer, Long, String>, Integer>> result = joinDs.collect();
    String expected = "(1,1,Hi),1\n" + "(2,2,Hello),2\n" + "(3,2,Hello world),null\n";
    compareResultAsTuples(result, expected);
}
Also used : ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) Tuple2(org.apache.flink.api.java.tuple.Tuple2) Tuple3(org.apache.flink.api.java.tuple.Tuple3) GenericTypeInfo(org.apache.flink.api.java.typeutils.GenericTypeInfo) Test(org.junit.Test)

Aggregations

GenericTypeInfo (org.apache.flink.api.java.typeutils.GenericTypeInfo)26 Test (org.junit.Test)18 ValueStateDescriptor (org.apache.flink.api.common.state.ValueStateDescriptor)10 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)9 KryoSerializer (org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer)8 BlockerCheckpointStreamFactory (org.apache.flink.runtime.util.BlockerCheckpointStreamFactory)8 IOException (java.io.IOException)6 BinaryRowData (org.apache.flink.table.data.binary.BinaryRowData)5 MyObj (org.apache.flink.table.data.util.DataFormatTestUtil.MyObj)5 CancellationException (java.util.concurrent.CancellationException)4 JobID (org.apache.flink.api.common.JobID)4 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)4 StateMigrationException (org.apache.flink.util.StateMigrationException)4 ExpectedException (org.junit.rules.ExpectedException)4 ByteBuffer (java.nio.ByteBuffer)3 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)3 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)3 DummyEnvironment (org.apache.flink.runtime.operators.testutils.DummyEnvironment)3 KvStateRegistry (org.apache.flink.runtime.query.KvStateRegistry)3 MemoryStateBackend (org.apache.flink.runtime.state.memory.MemoryStateBackend)3