Joining Pojos

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Joining Pojos

Benjamin Wootton
Hi All

I'm new to Flink.  I am having a lot of success but I'm struggling with Windowed joins over Pojos.

In a toy example I am trying to respond to flight delay events and pull some fields from flight details: 

flightDelaysStream
.map(new FlightDelaysMapper())
.join(flightDetailsStream)
.where( new FlightDelayKeySelector() )
.equalTo(new MyKeySelector() )

.window(TumblingEventTimeWindows.of(Time.seconds(10)))
.apply(new JF())
.print();

My problem is in the where and equalTo clauses.  I can't seem to specify a Key selector for flight details as the equalTo clause doesn't accept anything related to FlightDetails.  

All of the examples I can find online are Tuples.  Should this kind of thing be possible with Pojos?  Much prefer to stay in the domain objects if possible.

Thanks
Ben






Reply | Threaded
Open this post in threaded view
|

Re: Joining Pojos

Zhenghua Gao
POJO is available in KeySelector[1].
Could you provide more information about your problem? Version of Flink? Error messages?

On Mon, Sep 16, 2019 at 11:16 PM Benjamin Wootton <[hidden email]> wrote:
Hi All

I'm new to Flink.  I am having a lot of success but I'm struggling with Windowed joins over Pojos.

In a toy example I am trying to respond to flight delay events and pull some fields from flight details: 

flightDelaysStream
.map(new FlightDelaysMapper())
.join(flightDetailsStream)
.where( new FlightDelayKeySelector() )
.equalTo(new MyKeySelector() )

.window(TumblingEventTimeWindows.of(Time.seconds(10)))
.apply(new JF())
.print();

My problem is in the where and equalTo clauses.  I can't seem to specify a Key selector for flight details as the equalTo clause doesn't accept anything related to FlightDetails.  

All of the examples I can find online are Tuples.  Should this kind of thing be possible with Pojos?  Much prefer to stay in the domain objects if possible.

Thanks
Ben