Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> PigStorageWithInputPath and space as delimiter

Diederik van Liere 2012-10-25, 04:24
Copy link to this message
Re: PigStorageWithInputPath and space as delimiter
Hi Diederik,

I assume that you're using the example code in the wiki page? If so, you
need to add a constructor that takes arguments to your  UDF. The reason why
PigStorage works with arguments is because it has the following constructor:

    public PigStorage(String delimiter) {
        fieldDel = StorageUtil.parseFieldDel(delimiter);

But this constructor is not inherited by PigStorageWithInputPath even
though it extends PigStorage.


On Wed, Oct 24, 2012 at 9:24 PM, Diederik van Liere <[EMAIL PROTECTED]>wrote:

> Hi folks,
> I have been experimenting with the PigStorageWithInputPath example (see
> https://cwiki.apache.org/confluence/display/PIG/FAQ#FAQ-Q%3AIloaddatafromadirectorywhichcontainsdifferentfile.HowdoIfindoutwherethedatacomesfrom%3F
> )
> and it compiles.
> However when I instantiate it like PigStorageWithInputPath(' ') in Grunt I
> get the following error:
> could not instantiate 'PigStorageWithInputPath' with arguments '[ ]'. I
> have also tried supplying '\s' and '\\s' but it doesn't work. I don't fully
> understand why this happens as PigStorage(' ') does work
> and PigStorageWithInputPath does not change the instantiation of the class
> (AFAICT). I am using Hive 0.9.2
> Any suggestions are greatly appreciated!
> Best,
> Diederik