BLHofn opened a new pull request #17611:
URL: https://github.com/apache/flink/pull/17611


   Fix the interval join java case in the official document case
   
   Document link:
   
https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/stream/operators/joining.html#interval-join
   
   1、Your case is:
   import org.apache.flink.api.java.functions.KeySelector;
   import org.apache.flink.streaming.api.functions.co.ProcessJoinFunction;
   import org.apache.flink.streaming.api.windowing.time.Time;
   
   ...
   
   DataStream<Integer> orangeStream = ...
   DataStream<Integer> greenStream = ...
   
   orangeStream
       .keyBy(<KeySelector>)
       .intervalJoin(greenStream.keyBy(<KeySelector>))
       .between(Time.milliseconds(-2), Time.milliseconds(1))
       .process (new ProcessJoinFunction<Integer, Integer, String(){
   
           @Override
           public void processElement(Integer left, Integer right, Context ctx, 
Collector<String> out) {
               out.collect(first + "," + second);
           }
       });
   
   2、After repair:
   import org.apache.flink.api.java.functions.KeySelector;
   import org.apache.flink.streaming.api.functions.co.ProcessJoinFunction;
   import org.apache.flink.streaming.api.windowing.time.Time;
   
   ...
   
   DataStream<Integer> orangeStream = ...
   DataStream<Integer> greenStream = ...
   
   orangeStream
       .keyBy(<KeySelector>)
       .intervalJoin(greenStream.keyBy(<KeySelector>))
       .between(Time.milliseconds(-2), Time.milliseconds(1))
       .process (new ProcessJoinFunction<Integer, Integer, String(){
   
           @Override
           public void processElement(Integer left, Integer right, Context ctx, 
Collector<String> out) {
               out.collect(left + "," + right);
           }
       });
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to