Hi, AFAIK, the `intervalJoin` of the DataStream could not do that. But I think you could try the SQL's intervalJoin[1] and you could find some examples in the `IntervalJoinITCase`[2].
[1] https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/sql/queries.html#joins [2] https://github.com/apache/flink/blob/59ae84069313ede60cf7ad3a9d2fe1bc07c4e460/flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/IntervalJoinITCase.scala Best, Guowei On Wed, Mar 17, 2021 at 5:06 PM Daksh Talwar <daksh.tal...@flipkart.com> wrote: > Hi, > > I'm exploring Interval Join > <https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/joining.html#interval-join> > as > a probable solution for joins between two streams of data, with a long > lookback period. While going through the official documentation, I couldn't > figure out a way to get events where there was no join in the interval. > > From the example quoted in the official doc (pasted below), how do I get > the events from orangeStream that did not join with any event in > greenStream in the [-2,+1] interval? > > 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); > } > }); > > > > Cheers, > Daksh > > > *-----------------------------------------------------------------------------------------* > > *This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they are > addressed. If you have received this email in error, please notify the > system manager. This message contains confidential information and is > intended only for the individual named. If you are not the named addressee, > you should not disseminate, distribute or copy this email. Please notify > the sender immediately by email if you have received this email by mistake > and delete this email from your system. If you are not the intended > recipient, you are notified that disclosing, copying, distributing or > taking any action in reliance on the contents of this information is > strictly prohibited.* > > > > *Any views or opinions presented in this email are solely those of the > author and do not necessarily represent those of the organization. Any > information on shares, debentures or similar instruments, recommended > product pricing, valuations and the like are for information purposes only. > It is not meant to be an instruction or recommendation, as the case may be, > to buy or to sell securities, products, services nor an offer to buy or > sell securities, products or services unless specifically stated to be so > on behalf of the Flipkart group. Employees of the Flipkart group of > companies are expressly required not to make defamatory statements and not > to infringe or authorise any infringement of copyright or any other legal > right by email communications. Any such communication is contrary to > organizational policy and outside the scope of the employment of the > individual concerned. The organization will not accept any liability in > respect of such communication, and the employee responsible will be > personally liable for any damages or other liability arising.* > > > > *Our organization accepts no liability for the content of this email, or > for the consequences of any actions taken on the basis of the information * > provided,* unless that information is subsequently confirmed in writing. > If you are not the intended recipient, you are notified that disclosing, > copying, distributing or taking any action in reliance on the contents of > this information is strictly prohibited.* > > > *-----------------------------------------------------------------------------------------* > >