/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction, TypeInformation)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction)} method is fixed * in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism. * * @deprecated This method will be removed once the {@link #apply(FlatJoinFunction)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be replaced by {@link #apply(FlatJoinFunction, TypeInformation)} in Flink 2.0. * So use the {@link #apply(FlatJoinFunction, TypeInformation)} in the future. */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism. * * @deprecated This method will be removed once the {@link #apply(FlatJoinFunction)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
public static DataStream<Tuple3<String, Integer, Integer>> runWindowJoin( DataStream<Tuple2<String, Integer>> grades, DataStream<Tuple2<String, Integer>> salaries, long windowSize) { return grades.join(salaries) .where(new NameKeySelector()) .equalTo(new NameKeySelector()) .window(TumblingEventTimeWindows.of(Time.milliseconds(windowSize))) .apply(new JoinFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Integer, Integer>>() { @Override public Tuple3<String, Integer, Integer> join( Tuple2<String, Integer> first, Tuple2<String, Integer> second) { return new Tuple3<String, Integer, Integer>(first.f0, first.f1, second.f1); } }); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction, TypeInformation)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); } }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction)} method is fixed * in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction)} method is fixed * in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction, TypeInformation)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism. * * @deprecated This method will be removed once the {@link #apply(FlatJoinFunction)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function) { return (SingleOutputStreamOperator<T>) apply(function); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be replaced by {@link #apply(FlatJoinFunction, TypeInformation)} in Flink 2.0. * So use the {@link #apply(FlatJoinFunction, TypeInformation)} in the future. */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(FlatJoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be removed once the {@link #apply(JoinFunction, TypeInformation)} * method is fixed in the next major version of Flink (2.0). */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(JoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
.equalTo(new Tuple3KeyExtractor()) .window(TumblingEventTimeWindows.of(Time.of(3, TimeUnit.MILLISECONDS))) .apply(new JoinFunction<Tuple3<String, String, Integer>, Tuple3<String, String, Integer>, String>() { @Override public String join(Tuple3<String, String, Integer> first, Tuple3<String, String, Integer> second) throws Exception {
.equalTo(new Tuple3KeyExtractor()) .window(TumblingEventTimeWindows.of(Time.of(3, TimeUnit.MILLISECONDS))) .apply(new JoinFunction<Tuple3<String, String, Integer>, Tuple3<String, String, Integer>, String>() { @Override public String join(Tuple3<String, String, Integer> first, Tuple3<String, String, Integer> second) throws Exception {
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p>Note: This method's return type does not support setting an operator-specific parallelism. * Due to binary backwards compatibility, this cannot be altered. Use the * {@link #with(FlatJoinFunction)}, method to set an operator-specific parallelism. */ public <T> DataStream<T> apply(FlatJoinFunction<T1, T2, T> function) { TypeInformation<T> resultType = TypeExtractor.getBinaryOperatorReturnType( function, FlatJoinFunction.class, 0, 1, 2, new int[]{2, 0}, input1.getType(), input2.getType(), "Join", false); return apply(function, resultType); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p>Note: This method's return type does not support setting an operator-specific parallelism. * Due to binary backwards compatibility, this cannot be altered. Use the {@link #with(JoinFunction)} * method to set an operator-specific parallelism. */ public <T> DataStream<T> apply(JoinFunction<T1, T2, T> function) { TypeInformation<T> resultType = TypeExtractor.getBinaryOperatorReturnType( function, JoinFunction.class, 0, 1, 2, TypeExtractor.NO_INDEX, input1.getType(), input2.getType(), "Join", false); return apply(function, resultType); }
public static DataStream<Tuple3<String, Integer, Integer>> runWindowJoin( DataStream<Tuple2<String, Integer>> grades, DataStream<Tuple2<String, Integer>> salaries, long windowSize) { return grades.join(salaries) .where(new NameKeySelector()) .equalTo(new NameKeySelector()) .window(TumblingEventTimeWindows.of(Time.milliseconds(windowSize))) .apply(new JoinFunction<Tuple2<String, Integer>, Tuple2<String, Integer>, Tuple3<String, Integer, Integer>>() { @Override public Tuple3<String, Integer, Integer> join( Tuple2<String, Integer> first, Tuple2<String, Integer> second) { return new Tuple3<String, Integer, Integer>(first.f0, first.f1, second.f1); } }); }
/** * Completes the join operation with the user function that is executed * for each combination of elements with the same key in a window. * * <p><b>Note:</b> This is a temporary workaround while the {@link #apply(JoinFunction, TypeInformation)} * method has the wrong return type and hence does not allow one to set an operator-specific * parallelism * * @deprecated This method will be replaced by {@link #apply(FlatJoinFunction, TypeInformation)} in Flink 2.0. * So use the {@link #apply(FlatJoinFunction, TypeInformation)} in the future. */ @PublicEvolving @Deprecated public <T> SingleOutputStreamOperator<T> with(FlatJoinFunction<T1, T2, T> function, TypeInformation<T> resultType) { return (SingleOutputStreamOperator<T>) apply(function, resultType); }
@Test public void testDelegateToCoGrouped() { Time lateness = Time.milliseconds(42L); JoinedStreams.WithWindow<String, String, String, TimeWindow> withLateness = dataStream1 .join(dataStream2) .where(keySelector) .equalTo(keySelector) .window(tsAssigner) .allowedLateness(lateness); withLateness.apply(joinFunction, BasicTypeInfo.STRING_TYPE_INFO); Assert.assertEquals(lateness.toMilliseconds(), withLateness.getCoGroupedWindowedStream().getAllowedLateness().toMilliseconds()); }