Yeah, if you are locked into an older version of Pig you don't really have any option. Lobby EMR to use .11 once it is released :)
2013/2/1 Dexin Wang <wangde...@gmail.com> > Thanks. That'll be nice unfortunately we are using EMR which only has 0.9 > so that's not an option for us. > > Similar question for Python UDF. In my Python UDF, is referencing field by > index (instead of alias) is the only option I have? > > > On Tue, Jan 15, 2013 at 2:20 PM, Jonathan Coveney <jcove...@gmail.com > >wrote: > > > Another way to do it would be to make a helper function that does the > > following: > > > > input.get(getInputSchema().getPosition(alias)); > > > > Only available in 0.10 and later (I think getInputSchema is in 0.10, at > > least...may only be in 0.11) > > > > > > 2013/1/15 Dexin Wang <wangde...@gmail.com> > > > > > Hi, > > > > > > In my own UDF, is reference a field by index the only way to access a > > > field? > > > > > > The fields are all named and typed before passing into UDF but looks > > like I > > > can only do something like this: > > > > > > String v1 = (String)input.get(0); > > > String v2 = (String)input.get(1); > > > String v3 = (String)input.get(2); > > > > > > instead I'd like to do something like this: > > > > > > String v1 = (String)input.get("f1"); > > > String v2 = (String)input.get("f2"); > > > String v3 = (String)input.get("f3"); > > > > > > since I have lots of field and I don't want to tie myself up the > > > positioning of the fields. > > > > > > Any alternative? Thanks. > > > > > > Dexin > > > > > >