Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig, mail # dev - Should you be able to nest operators in a foreach like you normally can?


+
Jonathan Coveney 2011-11-11, 20:22
Copy link to this message
-
Re: Should you be able to nest operators in a foreach like you normally can?
Gianmarco De Francisci Mo... 2011-11-12, 10:49
I think the answer is:
annoying to implement and with not so compelling use cases.

The nested expressions take a different path in the parser in order to
distinguish them from the non-nested ones. So you would probably need to
replicate some code here and there to make this work. It can be done if you
think it is worth doing.

Cheers,
--
Gianmarco

On Fri, Nov 11, 2011 at 21:22, Jonathan Coveney <[EMAIL PROTECTED]> wrote:

> This works:
>
> a = load 'thing';
> b = foreach (group a all) {
>  sorted = order a by $0;
>  top = limit sorted 100;
>  generate flatten(top);
> }
>
> This does not (neither in pig8 nor in pig9, to my knowledge):
>
> a = load 'thing';
> b = foreach (group a all) {
>  top = limit (order a by $0) 100;
>  generate flatten(top);
> }
>
> Just curious if this is a design choice, design limitation, annoying to
> implement, etc. Thought I'd bring it up.
>
> Jon, your man for "nested foreach" posts to the dev listserv
>
+
Jonathan Coveney 2011-11-13, 01:25
+
Gianmarco De Francisci Mo... 2011-11-13, 10:13
+
Jonathan Coveney 2011-11-14, 00:00