org.apache.hcatalog.data.schema
Class HCatFieldSchema

java.lang.Object
  extended by org.apache.hcatalog.data.schema.HCatFieldSchema
All Implemented Interfaces:
java.io.Serializable

public class HCatFieldSchema
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class HCatFieldSchema.Category
           
static class HCatFieldSchema.Type
           
 
Constructor Summary
HCatFieldSchema(java.lang.String fieldName, HCatFieldSchema.Type type, HCatFieldSchema.Type mapKeyType, HCatSchema mapValueSchema, java.lang.String comment)
          Constructor for constructing a MAP type HCatFieldSchema, passing type of key and value
HCatFieldSchema(java.lang.String fieldName, HCatFieldSchema.Type type, HCatSchema subSchema, java.lang.String comment)
          Constructor for constructing a ARRAY type or STRUCT type HCatFieldSchema, passing type and subschema
HCatFieldSchema(java.lang.String fieldName, HCatFieldSchema.Type type, java.lang.String comment)
          Constructor constructing a primitive datatype HCatFieldSchema
 
Method Summary
 HCatSchema getArrayElementSchema()
           
 HCatFieldSchema.Category getCategory()
          Returns category of the field
 java.lang.String getComment()
           
 HCatFieldSchema.Type getMapKeyType()
           
 HCatSchema getMapValueSchema()
           
 java.lang.String getName()
          Returns name of the field
 HCatSchema getStructSubSchema()
           
 HCatFieldSchema.Type getType()
          Returns type of the field
 java.lang.String getTypeString()
           
 boolean isComplex()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HCatFieldSchema

public HCatFieldSchema(java.lang.String fieldName,
                       HCatFieldSchema.Type type,
                       java.lang.String comment)
                throws HCatException
Constructor constructing a primitive datatype HCatFieldSchema

Parameters:
fieldName - Name of the primitive field
type - Type of the primitive field
Throws:
HCatException - if call made on non-primitive types

HCatFieldSchema

public HCatFieldSchema(java.lang.String fieldName,
                       HCatFieldSchema.Type type,
                       HCatSchema subSchema,
                       java.lang.String comment)
                throws HCatException
Constructor for constructing a ARRAY type or STRUCT type HCatFieldSchema, passing type and subschema

Parameters:
fieldName - Name of the array or struct field
type - Type of the field - either Type.ARRAY or Type.STRUCT
subSchema - - subschema of the struct, or element schema of the elements in the array
Throws:
HCatException - if call made on Primitive or Map types

HCatFieldSchema

public HCatFieldSchema(java.lang.String fieldName,
                       HCatFieldSchema.Type type,
                       HCatFieldSchema.Type mapKeyType,
                       HCatSchema mapValueSchema,
                       java.lang.String comment)
                throws HCatException
Constructor for constructing a MAP type HCatFieldSchema, passing type of key and value

Parameters:
fieldName - Name of the array or struct field
type - Type of the field - must be Type.MAP
mapKeyType - - key type of the Map
mapValueSchema - - subschema of the value of the Map
Throws:
HCatException - if call made on non-Map types
Method Detail

isComplex

public boolean isComplex()

getType

public HCatFieldSchema.Type getType()
Returns type of the field

Returns:
type of the field

getCategory

public HCatFieldSchema.Category getCategory()
Returns category of the field

Returns:
category of the field

getName

public java.lang.String getName()
Returns name of the field

Returns:
name of the field

getComment

public java.lang.String getComment()

getStructSubSchema

public HCatSchema getStructSubSchema()
                              throws HCatException
Throws:
HCatException

getArrayElementSchema

public HCatSchema getArrayElementSchema()
                                 throws HCatException
Throws:
HCatException

getMapKeyType

public HCatFieldSchema.Type getMapKeyType()
                                   throws HCatException
Throws:
HCatException

getMapValueSchema

public HCatSchema getMapValueSchema()
                             throws HCatException
Throws:
HCatException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTypeString

public java.lang.String getTypeString()