Pergunta

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 :)

Foi útil?

Solução

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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top