You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Benjamin Wootton <be...@gmail.com> on 2019/09/16 15:16:28 UTC

Joining Pojos

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

Re: Joining Pojos

Posted by Zhenghua Gao <do...@gmail.com>.
POJO is available in KeySelector[1].
Could you provide more information about your problem? Version of Flink?
Error messages?

[1]
https://ci.apache.org/projects/flink/flink-docs-stable/dev/api_concepts.html#define-keys-using-key-selector-functions

*Best Regards,*
*Zhenghua Gao*


On Mon, Sep 16, 2019 at 11:16 PM Benjamin Wootton <
benjamin.wootton.personal@gmail.com> 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
>
>
>
>
>
>
>