You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Haijun Cao <ha...@kindsight.net> on 2008/06/04 01:49:35 UTC

a builtin function to return number of fields?

Hi, 

I am grouping by $1, but got IndexOutofBoundException because some rows
are mal-formed, they only have 1 field.

Is there a built-in function to return the number of fields for each
row? So I can ignore those rows myself. 

Or, even better, automatically ignore the mal-formed rows for me? 

Thanks
Haijun

RE: a builtin function to return number of fields?

Posted by Haijun Cao <ha...@kindsight.net>.
Amir,

Thanks for the pointer. It works for me. I need to look at the twiki more closely. :-)



Haijun


-----Original Message-----
From: Amir Youssefi [mailto:amiry@yahoo-inc.com]
Sent: Tue 6/3/2008 7:57 PM
To: pig-user@incubator.apache.org
Subject: RE: a builtin function to return number of fields?
 
ARITY - computes the number of fields in a tuple (also known as the
"arity" of a tuple) 

Amir

-----Original Message-----
From: Haijun Cao [mailto:haijun@kindsight.net] 
Sent: Tuesday, June 03, 2008 4:50 PM
To: pig-user@incubator.apache.org
Subject: a builtin function to return number of fields?

Hi, 

I am grouping by $1, but got IndexOutofBoundException because some rows
are mal-formed, they only have 1 field.

Is there a built-in function to return the number of fields for each
row? So I can ignore those rows myself. 

Or, even better, automatically ignore the mal-formed rows for me? 

Thanks
Haijun


RE: a builtin function to return number of fields?

Posted by Amir Youssefi <am...@yahoo-inc.com>.
ARITY - computes the number of fields in a tuple (also known as the
"arity" of a tuple) 

Amir

-----Original Message-----
From: Haijun Cao [mailto:haijun@kindsight.net] 
Sent: Tuesday, June 03, 2008 4:50 PM
To: pig-user@incubator.apache.org
Subject: a builtin function to return number of fields?

Hi, 

I am grouping by $1, but got IndexOutofBoundException because some rows
are mal-formed, they only have 1 field.

Is there a built-in function to return the number of fields for each
row? So I can ignore those rows myself. 

Or, even better, automatically ignore the mal-formed rows for me? 

Thanks
Haijun