Search in sources :

Example 1 with KeySelector3

use of org.apache.flink.api.common.operators.SelectorFunctionKeysTest.KeySelector3 in project flink by apache.

the class ExpressionKeysTest method testAreCompatible9.

@Test
public void testAreCompatible9() throws Keys.IncompatibleKeysException {
    TypeInformation<Tuple3<String, Long, Integer>> t1 = new TupleTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
    TypeInformation<PojoWithMultiplePojos> t2 = TypeExtractor.getForClass(PojoWithMultiplePojos.class);
    ExpressionKeys<Tuple3<String, Long, Integer>> ek1 = new ExpressionKeys<>(new int[] { 2, 0 }, t1);
    Keys<PojoWithMultiplePojos> ek2 = new Keys.SelectorFunctionKeys<>(new KeySelector3(), t2, new TupleTypeInfo<Tuple2<Integer, String>>(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO));
    Assert.assertTrue(ek1.areCompatible(ek2));
}
Also used : KeySelector3(org.apache.flink.api.common.operators.SelectorFunctionKeysTest.KeySelector3) ExpressionKeys(org.apache.flink.api.common.operators.Keys.ExpressionKeys) Tuple2(org.apache.flink.api.java.tuple.Tuple2) Tuple3(org.apache.flink.api.java.tuple.Tuple3) TupleTypeInfo(org.apache.flink.api.java.typeutils.TupleTypeInfo) Test(org.junit.Test)

Aggregations

ExpressionKeys (org.apache.flink.api.common.operators.Keys.ExpressionKeys)1 KeySelector3 (org.apache.flink.api.common.operators.SelectorFunctionKeysTest.KeySelector3)1 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)1 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)1 TupleTypeInfo (org.apache.flink.api.java.typeutils.TupleTypeInfo)1 Test (org.junit.Test)1