My PIG script has the following line
register 'foo.py' USING jython as foo;
The file foo.py is present in HDFS root.
but when I run my code I get error
ERROR 2997: Encountered IOException. File foo.py does not exist
I did google and found this thread
Encountered IOException while registering python UDF in pig. File helloworld.py does not exist
The solution seems to imply that the foo.py must be copied on the local file system to make it work. but that is not an option for me.
I want to copy foo.py on HDFS and then use it from the pig script.
I already tried register './foo.py' USING jython as foo;
and I can confirm that foo.py is present in the root HDFS directory.
I also tried changing the permissions on the foo.py file to rwxrwxrwx
but there is no way pig can find that file.
Edit:: Since I am using Hortonworks bistro I also tried to register my UDF in the UDF tab. but It still gives the same error even after registering.
Edit2:: I also copied util.py in the /user/admin
directory and gave rwxrwxrwx
permissions. but still can't find the py file.
Edit3:: also tried register 'hdfs://foo.py' USING jython as util;
but still won't find it.
If it's in the root, you want /foo.py
To clarify loading from HDFS, then three slashes are needed hdfs:///foo.py
(because the full syntax is hdfs://namenode:port/fileURI
)
Using ./foo.py
implies the root of the HDFS user folder for the user running the command