Ramana,

Actually, there's no binary type in Pig. If you do not specify the type in
load statement, the default type is byte array.  I'm afraid you have to
write a UDF to do the binary comparison. In the UDF, you should first
convert the byte array to binary and then compare the two binaries.




On Wed, Jan 27, 2010 at 11:38 PM, Ramana Venkata <[email protected]>wrote:

> Hi
>  I want to create UDF which compares a tuple with a string value like this.
>
> public class IsEqual extends FilterFunc {
>    public Boolean exec(Tuple input,String str) throws IOException {
>  // binary compary of AND is performed here;
>  // if result of AND is not zero it will return true;
>  return true;
> }
>
>
> is it possible with pig UDF ??;
>
> Actually i want to compare two binary type data with AND operation as
> fallows
>
> Table data is
>
> ramana      1010101
> krishna      1000010
> venkata     1101010
> ......
> load 'data' as name,category using PigStorate("\t");
> cameusers = filter data  by  IsEqual(category,"1000010");
> store cameusers;
> -----------------------------------
> result i am expected is ...............
> krishna      1000010
>
>
> Is there any other solution for this operation without UDF? can we
> compare category column with binary data?
>
>
> Please give responce..
>
>
> thanks
> ramanaiah
>



-- 
Best Regards

Jeff Zhang

Reply via email to