At runtime, you can determine the schema of a tuple using
determineFieldSchema(Object o) in DataType.javahttp://svn.apache.org/viewvc/hadoop/pig/branches/types/src/org/apache/pi
I have attached a previous email thread about accessing schemas in UDFs.
It's a good question regarding the ability of user defined functions
(including storage functions) to query the schema. Maybe Pig should
support it. Would like to hear thoughts from other people on the list.
From: Ian Holsman [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 09, 2008 7:04 PM
To: [EMAIL PROTECTED]
Subject: accessing the schema in a custom Storage UDF
I'm trying to write a custom StorFunc to push data into a database.
I've come into 2 issues with the interface.
Firstly 'bindTo'. It assumes that I will be writing to a file. This
presents an issue for me as I'm not. I could use that spot in the
grammar to pass a table name or something though.
Secondly I'd like to be able to get the schema of the Tuple
(specifically the name of it) so I can create field/column mappings and
hopefully be able to store bags/maps as well.
any chance of getting the interface changed so we can get the schema