You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by jamal sasha <ja...@gmail.com> on 2012/12/12 20:23:24 UTC

error

mf0 = LOAD 'max.txt’ AS (maxi:double);

data =  LOAD
'/axp/rimimsat/userdata/msing137/hadoop_streaming/final_anomaly_detection/step3/output'
USING PigStorage(',')

                                                AS (id:long, f0:double)

gruped =  group data all;

nf0 = foreach gruped generate features.id,features.f0/mf0;



But I am getting an error in last line?

Invalid scalar projection: mf0 : A column needs to be projected from a
relation for it to be used as a scalar





What am I missing

Thanks

Re: error

Posted by Ramakrishna Nalam <nr...@gmail.com>.
What is the intention of the script?
foreach on the 'gruped' field here means you'll get only a single row
(because of GROUP .. ALL). the field features.f0 will be a bag.
mf0 is also a bag. Refer to
http://pig.apache.org/docs/r0.7.0/piglatin_ref2.html#Data+Types

Division of 2 bags doesnt make a lot of sense.
I'm guessing mf0 set contains only a single line, but what's the intent of
the script here?



On Thu, Dec 13, 2012 at 12:55 AM, jamal sasha <ja...@gmail.com> wrote:

> Eh sorry
>
> nf0 = foreach gruped generate features.id,features.f0/mf0;
>
> Should be
> nf0 = foreach gruped generate data.id,data.f0/mf0;
> ---------- Forwarded message ----------
> From: jamal sasha
> Date: Wednesday, December 12, 2012
> Subject: error
> To: "user@pig.apache.org" <us...@pig.apache.org>
>
>
>
>
> mf0 = LOAD 'max.txt’ AS (maxi:double);
>
> data =  LOAD
>
> '/axp/rimimsat/userdata/msing137/hadoop_streaming/final_anomaly_detection/step3/output'
> USING PigStorage(',')
>
>                                                 AS (id:long, f0:double)
>
> gruped =  group data all;
>
> nf0 = foreach gruped generate features.id,features.f0/mf0;
>
>
>
> But I am getting an error in last line?
>
> Invalid scalar projection: mf0 : A column needs to be projected from a
> relation for it to be used as a scalar
>
>
>
>
>
> What am I missing
>
> Thanks
>

Fwd: error

Posted by jamal sasha <ja...@gmail.com>.
Eh sorry

nf0 = foreach gruped generate features.id,features.f0/mf0;

Should be
nf0 = foreach gruped generate data.id,data.f0/mf0;
---------- Forwarded message ----------
From: jamal sasha
Date: Wednesday, December 12, 2012
Subject: error
To: "user@pig.apache.org" <us...@pig.apache.org>




mf0 = LOAD 'max.txt’ AS (maxi:double);

data =  LOAD
'/axp/rimimsat/userdata/msing137/hadoop_streaming/final_anomaly_detection/step3/output'
USING PigStorage(',')

                                                AS (id:long, f0:double)

gruped =  group data all;

nf0 = foreach gruped generate features.id,features.f0/mf0;



But I am getting an error in last line?

Invalid scalar projection: mf0 : A column needs to be projected from a
relation for it to be used as a scalar





What am I missing

Thanks