org.apache.pig.impl.logicalLayer.schema
Class SchemaUtil

java.lang.Object
  extended by org.apache.pig.impl.logicalLayer.schema.SchemaUtil

public class SchemaUtil
extends Object

A utility class for simplify the schema creation, especially for bag and tuple schema. Currently, it only support simple schema creation, nested tuple and bag is not supported


Constructor Summary
SchemaUtil()
           
 
Method Summary
static Schema newBagSchema(Byte[] dataTypes)
          Create a new tuple schema according one array: the type of fields, the tuple name is t, and the bag name is b.
static Schema newBagSchema(List<Byte> dataTypes)
          Create a new tuple schema according one list: types of fields, the default names of fields are f0,f1,f2..., and the tuple is t, the bag name is b.
static Schema newBagSchema(List<String> names, List<Byte> dataTypes)
          Create a bag schema according two list: name of fields, type of fields, and the default bag name is b, the default tuple name is t.
static Schema newBagSchema(String[] names, Byte[] dataTypes)
          Create a new tuple schema according two arrays: names of field,types of fields.
static Schema newBagSchema(String bagName, String tupleName, List<String> fieldNames, List<Byte> dataTypes)
          Create a bag schema according the bag name,tuple name and two list: name of fields, type of fields
static Schema newBagSchema(String bagName, String tupleName, String[] fieldNames, Byte[] dataTypes)
           
static Schema newTupleSchema(Byte[] dataTypes)
          Create a new tuple schema according one array: types of fields, the default names of fields are f0,f1,f2..., and the tuple name is t.
static Schema newTupleSchema(List<Byte> dataTypes)
          Create a new tuple schema according one list: types of fields, the default names of fields are f0,f1,f2..., and the tuple name is t.
static Schema newTupleSchema(List<String> fieldNames, List<Byte> dataTypes)
          Create a new tuple schema according the two list: names of fields, types of fields, the default tuple name is t.
static Schema newTupleSchema(String[] names, Byte[] dataTypes)
          Create a new tuple schema according the two arrays: names of fields, types of fields, the default tuple name is t.
static Schema newTupleSchema(String tupleName, List<String> fieldNames, List<Byte> dataTypes)
          Create a new tuple schema according the tuple name and two list: names of fields, types of fields
static Schema newTupleSchema(String tupleName, String[] fieldNames, Byte[] dataTypes)
          Create a new tuple schema according the tuple name and two arrays: names of fields, types of fields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaUtil

public SchemaUtil()
Method Detail

newTupleSchema

public static Schema newTupleSchema(String tupleName,
                                    List<String> fieldNames,
                                    List<Byte> dataTypes)
                             throws FrontendException
Create a new tuple schema according the tuple name and two list: names of fields, types of fields

Parameters:
tupleName -
fieldNames -
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newTupleSchema

public static Schema newTupleSchema(String tupleName,
                                    String[] fieldNames,
                                    Byte[] dataTypes)
                             throws FrontendException
Create a new tuple schema according the tuple name and two arrays: names of fields, types of fields

Parameters:
tupleName -
fieldNames -
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newTupleSchema

public static Schema newTupleSchema(List<String> fieldNames,
                                    List<Byte> dataTypes)
                             throws FrontendException
Create a new tuple schema according the two list: names of fields, types of fields, the default tuple name is t.

Parameters:
fieldNames -
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newTupleSchema

public static Schema newTupleSchema(List<Byte> dataTypes)
                             throws FrontendException
Create a new tuple schema according one list: types of fields, the default names of fields are f0,f1,f2..., and the tuple name is t.

Parameters:
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newTupleSchema

public static Schema newTupleSchema(String[] names,
                                    Byte[] dataTypes)
                             throws FrontendException
Create a new tuple schema according the two arrays: names of fields, types of fields, the default tuple name is t.

Parameters:
names -
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newTupleSchema

public static Schema newTupleSchema(Byte[] dataTypes)
                             throws FrontendException
Create a new tuple schema according one array: types of fields, the default names of fields are f0,f1,f2..., and the tuple name is t.

Parameters:
dataTypes -
Returns:
tuple schema
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(String bagName,
                                  String tupleName,
                                  List<String> fieldNames,
                                  List<Byte> dataTypes)
                           throws FrontendException
Create a bag schema according the bag name,tuple name and two list: name of fields, type of fields

Parameters:
bagName -
tupleName -
fieldNames -
dataTypes -
Returns:
bag schema
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(String bagName,
                                  String tupleName,
                                  String[] fieldNames,
                                  Byte[] dataTypes)
                           throws FrontendException
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(List<String> names,
                                  List<Byte> dataTypes)
                           throws FrontendException
Create a bag schema according two list: name of fields, type of fields, and the default bag name is b, the default tuple name is t.

Parameters:
names -
dataTypes -
Returns:
bag schema
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(List<Byte> dataTypes)
                           throws FrontendException
Create a new tuple schema according one list: types of fields, the default names of fields are f0,f1,f2..., and the tuple is t, the bag name is b.

Parameters:
dataTypes -
Returns:
bag schema
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(String[] names,
                                  Byte[] dataTypes)
                           throws FrontendException
Create a new tuple schema according two arrays: names of field,types of fields. The default tuple name is t, and the bag is b.

Parameters:
names -
dataTypes -
Returns:
bag schema
Throws:
FrontendException

newBagSchema

public static Schema newBagSchema(Byte[] dataTypes)
                           throws FrontendException
Create a new tuple schema according one array: the type of fields, the tuple name is t, and the bag name is b.

Parameters:
dataTypes -
Returns:
bag schema
Throws:
FrontendException


Copyright © 2007-2012 The Apache Software Foundation