Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

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


Copy link to this message
-
Re: Should you be able to nest operators in a foreach like you normally can?
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
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB