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 # user >> error with FLATTEN and nested generate


Copy link to this message
-
error with FLATTEN and nested generate
I'm trying to run the following code, ---- I had another piece of code that
looks exactly the same , just var name differences, that one runs fine,
but this one gave errors:

2012-06-20 20:14:38,285 [main] INFO  org.apache.pig.Main - Apache Pig
version 0.10.0-SNAPSHOT (rexported) compiled Jun 20 2012, 16:31:38
2012-06-20 20:14:38,285 [main] INFO  org.apache.pig.Main - Logging error
messages to:
/crypt/yyang_home/work/matching/ML-places-matcher/control_flows/match_suspects/pig_1340248478278.log
2012-06-20 20:14:38,644 [main] INFO
 org.apache.pig.backend.hadoop.executionengine.HExecutionEngine -
Connecting to hadoop file system at: file:///
2012-06-20 20:14:39,148 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1200: Pig script failed to parse:
<file a.pig, line 11, column 39> Invalid scalar projection: aa : A column
needs to be projected from a relation for it to be used as a scalar

where I'm I doing wrong?

Thanks a lot
yang

######################################

aa = load 'b' as (x:int , y:int);

b = group aa by x;

c = group b by group ;

-- describe c;
-- c: {group: int,b: {(group: int,aa: {(x: int,y: int)})}}

d = foreach c {
       xx = foreach b generate FLATTEN(aa) as (o:int, p:int);
       generate group , MIN(xx.x);
    };

dump d;
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