Grokbase Groups Pig user May 2011
FAQ
Hi list,

I am using pig 0.8.0, about to try a python UDF. But I can’t get the examples from
http://pig.apache.org/docs/r0.8.0/udf.html#Python+UDFs
to work, so, presumably I have some setup problem. Using hints from some other posts on this list, I think my CLASSPATH is OK; jython itself at least is visible.

The script (cut and paste from the python UDF manual):

#!/usr/bin/python

##################
# Math functions #
##################
#Square - Square of a number of any data type
@outputSchemaFunction("squareSchema")
def square(num):
return ((num)*(num))
@schemaFunction("squareSchema")
def squareSchema(input):
return input
[…]

My symptom (running pig -x local):
grunt> register '../mySampleLib.py' using jython as myfuncs;
<string>:1:[SyntaxWarning]: local name 'schema_def' in 'outputSchema' shadows use as global in nested scopes
<string>:1:[SyntaxWarning]: local name 'schema_def' in 'outputSchemaFunction' shadows use as global in nested scopes
<string>:1:[SyntaxWarning]: local name 'schema_def' in 'schemaFunction' shadows use as global in nested scopes
2011-05-02 16:36:51,767 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2999: Unexpected internal error. null
Details at logfile:…../pig_1304368572627.log

$ cat pig_1304368572627.log
Pig Stack Trace
---------------
ERROR 2999: Unexpected internal error. null

Traceback (innermost last):
(no code object) at line 0
SyntaxError: ('Lexical error at line 7, column 1. Encountered: "@" (64), after : ""', ('<iostream>', 7, 1, '@outputSchemaFunction("squareSchema")'))

Any help would be appreciated. Thanks,

Will


William F Dowling
Sr Technical Specialist, Software Engineering
Thomson Reuters

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMay 2, '11 at 9:00p
activeMay 2, '11 at 9:00p
posts1
users1
websitepig.apache.org

1 user in discussion

William Dowling: 1 post

People

Translate

site design / logo © 2021 Grokbase