I wrote a simple UDF in python for PIG
@outputSchema("date: chararray")
def to_date2(dt):
print dt
a = dt.split("/")
print a
return "20" + a[2] + a[0] + a[1]
I am reading a CSV which has a column like "1/1/17" and I am trying to convert it into 201711
using this UDF.
I get an error
Caused by: Traceback (most recent call last):
File "/tmp/pig715837049480092569tmp/util2.py", line 20, in to_date2
IndexError: index out of range: 2
but I can't see any of my print statements in the job run log.
If I am writing a python UDF how to I print things into the Hadoop log? so that I can see what was the value of dt which was passed to my function?