Question

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 to get the names of the fields.

public class PigJsonStorage extends StoreFunc { .. }

Can anybody help me :)

Was it helpful?

Solution

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.

OTHER TIPS

There's a class JsonMetadata that returns ResourceSchema which has a method returning an array of fields.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top