How to group and sort the output of a join

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

How to group and sort the output of a join

Martin Neumann
Hej,

After a join operation I end up with a Tuple2<Tuple10<...>Tuple2<...>> I
now want to group it on field 1 from the first inner Tuple and then sort it
by field 1 in the 2nd inner tuple.

How do I do that? I think I need to use the key extractor to get the
correct field but sort does not take one.

cheers Martin
Reply | Threaded
Open this post in threaded view
|

Re: How to group and sort the output of a join

Aljoscha Krettek-2
Hi,
this should be possible with:

.groupBy("f0.f0").sortGroup("f1.f0")

Robert recently did some work to allow accessing nested tuple fields
and fields of objects using string expressions. For tuple fields you
use "f0", "f1" and so on and the dot is used to access nested fields.

Cheers,
Aljoscha

On Wed, Oct 15, 2014 at 3:53 PM, Martin Neumann <[hidden email]> wrote:

> Hej,
>
> After a join operation I end up with a Tuple2<Tuple10<...>Tuple2<...>> I
> now want to group it on field 1 from the first inner Tuple and then sort it
> by field 1 in the 2nd inner tuple.
>
> How do I do that? I think I need to use the key extractor to get the
> correct field but sort does not take one.
>
> cheers Martin