Get names of field schema from Pig
I'm working on a JsonStorage for Pig. Everything works fine, but at least I need to get the names of the fields (i.e. crdate, name, positions) from the pig schema.
| A | crdate: bytearray | name: bytearray | positions: bytearray |
Actually I extend my class by StoreFunc that provides no function t开发者_如何学Co get the names of the fields.
public class PigJsonStorage extends StoreFunc { .. }
Can anybody help me :)
disclaimer: I'm a little new to pig myself, and haven't implemented a storage class yet.
It looks to me like StoreFunc has a method for this: StoreFunc.checkSchema(ResourceSchema s). I would think you could just capture the schema from that for use during the write.
There's a class JsonMetadata that returns ResourceSchema which has a method returning an array of fields.
精彩评论