Jagat,

There is no plumbing in place to naturally call static methods etc...it's
all just UDFs. What there is is the InvokeForString udf, which could handle
this, but there is a performance penalty. I think there areUDFs in pig that
do what you want, though, per gianmarco's post.

Kris,

There is not currently an extensible way to do what you're talking about,
however there is a JIRA where I proposed it:
https://issues.apache.org/jira/browse/PIG-2643

which if you read down, we talk about a couple of syntax proposals to make
it easier to access data type members. I would love to allow you do to do
something like:

a = load 'thing' as (x:chararray);
b = foreach a generate x.substring(0,1);

But it's hard to nail the syntax...if you think this would be a useful
feature it'd be great to get your thoughts.

Jagat,

You can't currently call the object method, though you could use the
current version of InvokeForString, though there is a performance penalty.

2012/4/13 Kris Coward <k...@melon.org>

>
> I'm pretty sure that Java's string handling already has something to do
> this, so you could probably call that the same way you'd call a UDF
> (assuming there isn't some pig latin to do the job for you). On the
> other hand, I think the call for that might be a method in the String
> class and don't know if pig has a nice way of calling a data type's
> methods. Now I'm curious if such a feature exists.
>
> -Kris
>
> On Fri, Apr 13, 2012 at 02:17:48PM +0200, Shin Chan wrote:
> > Hi all,
> >
> >  How to replace some value in string at particular location
> >
> >  For example
> >
> >  abcd
> >
> >  Replace values from index 0-1 with mn
> >
> >  mncd as output
> >
> >  Any built in UDF or i should write own UDF?.
> >
> >  I checked existing Replace method , it replaces value to some another
> value.
> >
> > Thanks and Regards ,
>
> --
> Kris Coward                                     http://unripe.melon.org/
> GPG Fingerprint: 2BF3 957D 310A FEEC 4733  830E 21A4 05C7 1FEB 12B3
>

Reply via email to