Left outer join

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

Left outer join

Thomas FOURNIER
Hello, I'm facing an issue with leftOuterJoin:

- input is a DataSet[String]
- metrics is a DataSet[(String,Long)]

I'm doing a leftOuterJoin like this:

input
.leftOuterJoin(metrics)
.where(0)
.equalTo(0) {
     (left,right)  =>     ...
}


But I encounter the following error:
Specifying keys via field positions is only valid for tuple data types.
Type: String

What is the correct way to handle this case (where left member has only one
field ?)

Thanks
Regards

Thomas
Reply | Threaded
Open this post in threaded view
|

Re: Left outer join

Till Rohrmann
Hi Thomas,

either you map your input data set into a tuple input.map(x => Tuple1(x))
or you specify a key selector leftOuterJoin(metrics).where(x =>
x).equalTo(0).

I think the user ML [hidden email] would be a better place to ask
Flink usage related questions. The dev ML is mainly used for technical
discussions.

Cheers,
Till


On Tue, Nov 8, 2016 at 10:58 PM, Thomas FOURNIER <
[hidden email]> wrote:

> Hello, I'm facing an issue with leftOuterJoin:
>
> - input is a DataSet[String]
> - metrics is a DataSet[(String,Long)]
>
> I'm doing a leftOuterJoin like this:
>
> input
> .leftOuterJoin(metrics)
> .where(0)
> .equalTo(0) {
>      (left,right)  =>     ...
> }
>
>
> But I encounter the following error:
> Specifying keys via field positions is only valid for tuple data types.
> Type: String
>
> What is the correct way to handle this case (where left member has only one
> field ?)
>
> Thanks
> Regards
>
> Thomas
>
Reply | Threaded
Open this post in threaded view
|

Re: Left outer join

Fabian Hueske-2
This should work as well:

input
.leftOuterJoin(metrics)
.where("*")
.equalTo(0) {
     (left,right)  =>     ...
}

2016-11-08 23:10 GMT+01:00 Till Rohrmann <[hidden email]>:

> Hi Thomas,
>
> either you map your input data set into a tuple input.map(x => Tuple1(x))
> or you specify a key selector leftOuterJoin(metrics).where(x =>
> x).equalTo(0).
>
> I think the user ML [hidden email] would be a better place to ask
> Flink usage related questions. The dev ML is mainly used for technical
> discussions.
>
> Cheers,
> Till
> ​
>
> On Tue, Nov 8, 2016 at 10:58 PM, Thomas FOURNIER <
> [hidden email]> wrote:
>
> > Hello, I'm facing an issue with leftOuterJoin:
> >
> > - input is a DataSet[String]
> > - metrics is a DataSet[(String,Long)]
> >
> > I'm doing a leftOuterJoin like this:
> >
> > input
> > .leftOuterJoin(metrics)
> > .where(0)
> > .equalTo(0) {
> >      (left,right)  =>     ...
> > }
> >
> >
> > But I encounter the following error:
> > Specifying keys via field positions is only valid for tuple data types.
> > Type: String
> >
> > What is the correct way to handle this case (where left member has only
> one
> > field ?)
> >
> > Thanks
> > Regards
> >
> > Thomas
> >
>