public class AvroStorageSchemaConversionUtilities extends Object
Constructor and Description |
---|
AvroStorageSchemaConversionUtilities() |
Modifier and Type | Method and Description |
---|---|
static ResourceSchema |
avroSchemaToResourceSchema(org.apache.avro.Schema s,
Boolean allowRecursiveSchema)
Translates an Avro schema to a Resource Schema (for Pig).
|
static byte |
getPigType(org.apache.avro.Schema s)
Determines the pig object type of the Avro schema.
|
static boolean |
isNullableUnion(org.apache.avro.Schema s)
Checks to see if an avro schema is a combination of
null and another object.
|
static boolean |
isUnionOfSimpleTypes(org.apache.avro.Schema s) |
static org.apache.avro.Schema |
newSchemaFromRequiredFieldList(org.apache.avro.Schema oldSchema,
List<LoadPushDown.RequiredField> rfl)
Takes an Avro Schema and a Pig RequiredFieldList and returns a new schema
with only the required fields, or no if the function can't extract only
those fields.
|
static org.apache.avro.Schema |
newSchemaFromRequiredFieldList(org.apache.avro.Schema oldSchema,
LoadPushDown.RequiredFieldList rfl)
Takes an Avro Schema and a Pig RequiredFieldList and returns a new schema
with only the requried fields, or no if the function can't extract only
those fields.
|
static org.apache.avro.Schema |
removeSimpleUnion(org.apache.avro.Schema s)
Given an input schema that is a union of an avro schema
and null (or just a union with one type), return the avro schema.
|
static org.apache.avro.Schema |
resourceSchemaToAvroSchema(ResourceSchema rs,
String recordName,
String recordNameSpace,
Map<String,List<org.apache.avro.Schema>> definedRecordNames,
Boolean doubleColonsToDoubleUnderscores)
Translated a ResourceSchema to an Avro Schema.
|
public AvroStorageSchemaConversionUtilities()
public static byte getPigType(org.apache.avro.Schema s) throws ExecException
s
- The avro schema for which to determine the typeExecException
Schema.Type
public static boolean isUnionOfSimpleTypes(org.apache.avro.Schema s)
public static ResourceSchema avroSchemaToResourceSchema(org.apache.avro.Schema s, Boolean allowRecursiveSchema) throws IOException
s
- The avro schema for which to determine the typeallowRecursiveSchema
- Flag indicating whether to
throw an error if a recursive schema definition is foundIOException
public static org.apache.avro.Schema resourceSchemaToAvroSchema(ResourceSchema rs, String recordName, String recordNameSpace, Map<String,List<org.apache.avro.Schema>> definedRecordNames, Boolean doubleColonsToDoubleUnderscores) throws IOException
rs
- Input schema.recordName
- Record namerecordNameSpace
- NamespacedefinedRecordNames
- Map of already defined record names
to schema objectsIOException
public static boolean isNullableUnion(org.apache.avro.Schema s)
s
- The object to checkpublic static org.apache.avro.Schema removeSimpleUnion(org.apache.avro.Schema s)
s
- The input schema objectpublic static org.apache.avro.Schema newSchemaFromRequiredFieldList(org.apache.avro.Schema oldSchema, LoadPushDown.RequiredFieldList rfl)
oldSchema
- The avro schema from which to extract the schemarfl
- the Pig required field listpublic static org.apache.avro.Schema newSchemaFromRequiredFieldList(org.apache.avro.Schema oldSchema, List<LoadPushDown.RequiredField> rfl)
oldSchema
- The avro schema from which to extract the schemarfl
- List of required fieldsCopyright © 2007-2017 The Apache Software Foundation