Reputation: 780
I am having trouble with the following pig code.
The previus var I need to read via FOREACH has the following DESCRIBE:
UnionD1D2_Distinct: {UnionD1D2_Foreach1::null::display_site: chararray,UnionD1D2_Foreach1::efectivos_click: long,UnionD1D2_Foreach2::null::display_site: chararray,UnionD1D2_Foreach2::total_click: long}
And here, example data:
(linuxlife.example.com,113,linuxlife.example.com,5343) (mobilesource.example.com,211,mobilesource.example.com,8120) (siliconshore.example.com,170,siliconshore.example.com,7764) (printoperator.example.com,62,printoperator.example.com,2724)
So, the FOREACH reads the data is:
UnionD1D2_Calc = FOREACH UnionD1D2_Distinct
GENERATE
(UnionD1D2_Distinct.UnionD1D2_Foreach1::efectivos_click1/UnionD1D2_Distinct.UnionD1D2_Foreach2::total_click2)*100 AS ctr;
But, I'm always getting the following:
ERROR 1066: Unable to open iterator for alias UnionD1D2_Calc. Backend error : Scalar has more than one row in the output. 1st : (filmport.example.com,121,filmport.example.com,5395), 2nd :(firesale.example.com,129,firesale.example.com,5452)
What am I doing wrong?
Upvotes: 0
Views: 43
Reputation: 722
When you're using FOREACH
on an alias, you don't need to use the alias name again to refer to a variable. For example, instead of UnionD1D2_Distinct.UnionD1D2_Foreach1::efectivos_click1
you can just use UnionD1D2_Foreach1::efectivos_click1
.
Please try:
UnionD1D2_Calc = FOREACH UnionD1D2_Distinct GENERATE
(UnionD1D2_Foreach1::efectivos_click1/UnionD1D2_Foreach2::total_click2)*100 AS ctr;
And let us know if you get the same error.
Upvotes: 0