org.apache.hcatalog.pig
Class PigHCatUtil

java.lang.Object
  extended by org.apache.hcatalog.pig.PigHCatUtil

public class PigHCatUtil
extends java.lang.Object


Constructor Summary
PigHCatUtil()
           
 
Method Summary
static java.lang.Object extractPigObject(java.lang.Object o, HCatFieldSchema hfs)
           
static void getConfigFromUDFProperties(java.util.Properties p, org.apache.hadoop.conf.Configuration config, java.lang.String propName)
           
static Pair<java.lang.String,java.lang.String> getDBTableNames(java.lang.String location)
           
static java.lang.String getHCatServerPrincipal(org.apache.hadoop.mapreduce.Job job)
           
static java.lang.String getHCatServerUri(org.apache.hadoop.mapreduce.Job job)
           
static byte getPigType(HCatFieldSchema.Type type)
           
static byte getPigType(HCatFieldSchema hfs)
           
static org.apache.pig.ResourceSchema getResourceSchema(HCatSchema hcatSchema)
           
 org.apache.hadoop.hive.metastore.api.Table getTable(java.lang.String location, java.lang.String hcatServerUri, java.lang.String hcatServerPrincipal)
           
static void saveConfigIntoUDFProperties(java.util.Properties p, org.apache.hadoop.conf.Configuration config, java.lang.String propName)
           
static org.apache.pig.data.DataBag transformToBag(java.util.List<? extends java.lang.Object> list, HCatFieldSchema hfs)
           
static java.util.Map<java.lang.String,java.lang.Object> transformToPigMap(java.util.Map<java.lang.String,java.lang.Object> map, HCatFieldSchema hfs)
           
static org.apache.pig.data.Tuple transformToTuple(HCatRecord hr, HCatSchema hs)
           
static org.apache.pig.data.Tuple transformToTuple(java.util.List<? extends java.lang.Object> objList, HCatFieldSchema hfs)
           
static org.apache.pig.data.Tuple transformToTuple(java.util.List<? extends java.lang.Object> objList, HCatSchema hs)
           
static void validateHCatTableSchemaFollowsPigRules(HCatSchema hcatTableSchema)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PigHCatUtil

public PigHCatUtil()
Method Detail

getDBTableNames

public static Pair<java.lang.String,java.lang.String> getDBTableNames(java.lang.String location)
                                                               throws java.io.IOException
Throws:
java.io.IOException

getHCatServerUri

public static java.lang.String getHCatServerUri(org.apache.hadoop.mapreduce.Job job)

getHCatServerPrincipal

public static java.lang.String getHCatServerPrincipal(org.apache.hadoop.mapreduce.Job job)

getTable

public org.apache.hadoop.hive.metastore.api.Table getTable(java.lang.String location,
                                                           java.lang.String hcatServerUri,
                                                           java.lang.String hcatServerPrincipal)
                                                    throws java.io.IOException
Throws:
java.io.IOException

getResourceSchema

public static org.apache.pig.ResourceSchema getResourceSchema(HCatSchema hcatSchema)
                                                       throws java.io.IOException
Throws:
java.io.IOException

getPigType

public static byte getPigType(HCatFieldSchema hfs)
                       throws java.io.IOException
Parameters:
hfs - the field schema of the column
Returns:
corresponding pig type
Throws:
java.io.IOException

getPigType

public static byte getPigType(HCatFieldSchema.Type type)
                       throws java.io.IOException
Throws:
java.io.IOException

transformToTuple

public static org.apache.pig.data.Tuple transformToTuple(HCatRecord hr,
                                                         HCatSchema hs)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

extractPigObject

public static java.lang.Object extractPigObject(java.lang.Object o,
                                                HCatFieldSchema hfs)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

transformToTuple

public static org.apache.pig.data.Tuple transformToTuple(java.util.List<? extends java.lang.Object> objList,
                                                         HCatFieldSchema hfs)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

transformToTuple

public static org.apache.pig.data.Tuple transformToTuple(java.util.List<? extends java.lang.Object> objList,
                                                         HCatSchema hs)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

transformToPigMap

public static java.util.Map<java.lang.String,java.lang.Object> transformToPigMap(java.util.Map<java.lang.String,java.lang.Object> map,
                                                                                 HCatFieldSchema hfs)
                                                                          throws java.lang.Exception
Throws:
java.lang.Exception

transformToBag

public static org.apache.pig.data.DataBag transformToBag(java.util.List<? extends java.lang.Object> list,
                                                         HCatFieldSchema hfs)
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

validateHCatTableSchemaFollowsPigRules

public static void validateHCatTableSchemaFollowsPigRules(HCatSchema hcatTableSchema)
                                                   throws java.io.IOException
Throws:
java.io.IOException

getConfigFromUDFProperties

public static void getConfigFromUDFProperties(java.util.Properties p,
                                              org.apache.hadoop.conf.Configuration config,
                                              java.lang.String propName)

saveConfigIntoUDFProperties

public static void saveConfigIntoUDFProperties(java.util.Properties p,
                                               org.apache.hadoop.conf.Configuration config,
                                               java.lang.String propName)