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 Plain View
Pig >> mail # user >> Can we pass tuple value in macro?


Copy link to this message
-
Can we pass tuple value in macro?
Hi,

I have this function which I am using for different group by fields, can I
call this macro like

calculate_sum(A,$0)
calculate_sum(A,($0,$1))
calculate_sum(A,($0,$1,$2))

define calculate_sum ( A, groupByField)
returns A_SUM1 {
        A_SUM = group $A by $groupByField;
        $A_SUM1 = foreach A_SUM generate FLATTEN(group),SUM($A.spend) as
spend,SUM($A.units) as units ;
        };

Thanks,

Deepak
+
Deepak Tiwari 2012-09-10, 17:00
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