|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.piggybank.storage.avro.PigSchema2Avro
public class PigSchema2Avro
This class contains functions to convert Pig schema to Avro. It consists of two sets of methods: 1. Convert a Pig schema to Avro schema; 2. Validate whether a Pig schema is compatible with a given Avro schema. Notice that the Avro schema doesn't need to cover all fields in Pig schema, and the missing fields are converted using methods in set 1.
Field Summary | |
---|---|
static String |
FIELD_NAME
|
static String |
TUPLE_NAME
|
static int |
tupleIndex
|
Constructor Summary | |
---|---|
PigSchema2Avro()
|
Method Summary | |
---|---|
protected static org.apache.avro.Schema |
convert(ResourceSchema.ResourceFieldSchema pigSchema,
boolean nullable)
Convert a Pig ResourceFieldSchema to avro schema |
static org.apache.avro.Schema |
convert(ResourceSchema pigSchema,
boolean nullable)
Convert a pig ResourceSchema to avro schema |
protected static org.apache.avro.Schema |
convertPrimitiveType(byte pigType)
Convert Pig primitive type to Avro type |
protected static org.apache.avro.Schema |
convertRecord(ResourceSchema.ResourceFieldSchema[] pigFields,
boolean nullable)
Convert pig data to Avro record |
protected static boolean |
isCompatible(org.apache.avro.Schema avroSchema,
ResourceSchema.ResourceFieldSchema pigSchema)
Check whether Avro type is compatible with Pig type |
static void |
setTupleIndex(int index)
This is a painful hack to make unit tests pass. |
protected static org.apache.avro.Schema |
validateAndConvert(org.apache.avro.Schema avroSchema,
ResourceSchema.ResourceFieldSchema pigSchema)
Validate whether pigSchema is compatible with avroSchema and convert those Pig fields with to corresponding Avro schemas. |
static org.apache.avro.Schema |
validateAndConvert(org.apache.avro.Schema avroSchema,
ResourceSchema pigSchema)
Validate whether pigSchema is compatible with avroSchema |
protected static org.apache.avro.Schema |
validateAndConvertRecord(org.apache.avro.Schema avroSchema,
ResourceSchema.ResourceFieldSchema[] pigFields)
Validate a Pig tuple is compatible with Avro record. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TUPLE_NAME
public static final String FIELD_NAME
public static int tupleIndex
Constructor Detail |
---|
public PigSchema2Avro()
Method Detail |
---|
public static org.apache.avro.Schema convert(ResourceSchema pigSchema, boolean nullable) throws IOException
IOException
protected static org.apache.avro.Schema convert(ResourceSchema.ResourceFieldSchema pigSchema, boolean nullable) throws IOException
IOException
protected static org.apache.avro.Schema convertRecord(ResourceSchema.ResourceFieldSchema[] pigFields, boolean nullable) throws IOException
IOException
public static void setTupleIndex(int index)
index
- protected static org.apache.avro.Schema convertPrimitiveType(byte pigType) throws IOException
IOException
public static org.apache.avro.Schema validateAndConvert(org.apache.avro.Schema avroSchema, ResourceSchema pigSchema) throws IOException
IOException
protected static org.apache.avro.Schema validateAndConvert(org.apache.avro.Schema avroSchema, ResourceSchema.ResourceFieldSchema pigSchema) throws IOException
IOException
protected static org.apache.avro.Schema validateAndConvertRecord(org.apache.avro.Schema avroSchema, ResourceSchema.ResourceFieldSchema[] pigFields) throws IOException
IOException
protected static boolean isCompatible(org.apache.avro.Schema avroSchema, ResourceSchema.ResourceFieldSchema pigSchema)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |