|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.impl.util.Utils
public class Utils
Class with utility static methods
Constructor Summary | |
---|---|
Utils()
|
Method Summary | ||
---|---|---|
static FuncSpec |
buildSimpleFuncSpec(String className,
byte... types)
|
|
static boolean |
checkNullAndClass(Object obj1,
Object obj2)
This method is a helper for classes to implement Object.equals(java.lang.Object)
The method checks whether the two arguments are both null or both not null and
whether they are of the same class |
|
static boolean |
checkNullEquals(Object obj1,
Object obj2,
boolean checkEquality)
This method is a helper for classes to implement Object.equals(java.lang.Object)
checks if two objects are equals - two levels of checks are
made - first if both are null or not null. |
|
static InputStream |
getCompositeStream(InputStream in,
Properties properties)
|
|
static ResourceSchema |
getSchema(LoadFunc wrappedLoadFunc,
String location,
boolean checkExistence,
org.apache.hadoop.mapreduce.Job job)
|
|
static Schema |
getSchemaFromBagSchemaString(String schemaString)
getSchemaFromBagSchemaString NOTE: use this call when you need to generate a Schema object from the representation generated by Schema#toString . |
|
static Schema |
getSchemaFromString(String schemaString)
|
|
static ResourceSchema |
getSchemaWithInputSourceTag(ResourceSchema schema,
String fieldName)
This method adds FieldSchema of 'input source tag/path' as the first field. |
|
static Schema |
getScriptSchema(String loadFuncSignature,
org.apache.hadoop.conf.Configuration conf)
A helper function for retrieving the script schema set by the LOLoad function. |
|
static String |
getScriptSchemaKey(String loadFuncSignature)
|
|
static String |
getStackStraceStr(Throwable e)
|
|
static String |
getStringFromArray(String[] arr)
|
|
static String |
getTmpFileCompressorName(PigContext pigContext)
|
|
static Class<? extends FileInputLoadFunc> |
getTmpFileStorageClass(Properties properties)
|
|
static FileInputLoadFunc |
getTmpFileStorageObject(org.apache.hadoop.conf.Configuration conf)
|
|
static boolean |
isLocal(PigContext pigContext,
org.apache.hadoop.conf.Configuration conf)
|
|
static
|
mergeCollection(Collection<O> a,
Collection<O> b)
|
|
static LogicalSchema |
parseSchema(String schemaString)
|
|
static void |
recomputeProperties(org.apache.hadoop.mapred.JobConf jobConf,
Properties properties)
Method to apply pig properties to JobConf (replaces properties with resulting jobConf values). |
|
static void |
setMapredCompressionCodecProps(org.apache.hadoop.conf.Configuration conf)
|
|
static void |
setTmpFileCompressionOnConf(PigContext pigContext,
org.apache.hadoop.conf.Configuration conf)
|
|
static String |
slashisize(String str)
Replace sequences of two slashes ("\\") with one slash ("\") (not escaping a slash in grunt is disallowed, but a double slash doesn't get converted into a regular slash, so we have to do it instead) |
|
static String |
substituteVars(String expr)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static boolean checkNullEquals(Object obj1, Object obj2, boolean checkEquality)
Object.equals(java.lang.Object)
checks if two objects are equals - two levels of checks are
made - first if both are null or not null. If either is null,
check is made whether both are null.
If both are non null, equality also is checked if so indicated
obj1
- first object to be comparedobj2
- second object to be comparedcheckEquality
- flag to indicate whether object equality should
be checked if obj1 and obj2 are non-null
public static boolean checkNullAndClass(Object obj1, Object obj2)
Object.equals(java.lang.Object)
The method checks whether the two arguments are both null or both not null and
whether they are of the same class
obj1
- first object to compareobj2
- second object to compare
public static Schema getScriptSchema(String loadFuncSignature, org.apache.hadoop.conf.Configuration conf) throws IOException
loadFuncSignature
- conf
-
IOException
public static String getScriptSchemaKey(String loadFuncSignature)
public static ResourceSchema getSchema(LoadFunc wrappedLoadFunc, String location, boolean checkExistence, org.apache.hadoop.mapreduce.Job job) throws IOException
IOException
public static Schema getSchemaFromString(String schemaString) throws ParserException
schemaString
- a String representation of the Schema without
any enclosing curly-braces.Not for use with
Schema#toString
ParserException
public static Schema getSchemaFromBagSchemaString(String schemaString) throws ParserException
Schema#toString
.
This call strips the enclosing outer curly braces from the toString
representation, which are placed there because the actual representation of
the schema data is as a Bag-type relation.
schemaString
- a String representation of the Schema to instantiate,
in the form generated by Schema.toString()
ParserException
public static LogicalSchema parseSchema(String schemaString) throws ParserException
ParserException
public static ResourceSchema getSchemaWithInputSourceTag(ResourceSchema schema, String fieldName)
schema
- fieldName
-
public static String getTmpFileCompressorName(PigContext pigContext)
public static FileInputLoadFunc getTmpFileStorageObject(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public static Class<? extends FileInputLoadFunc> getTmpFileStorageClass(Properties properties)
public static void setMapredCompressionCodecProps(org.apache.hadoop.conf.Configuration conf)
public static void setTmpFileCompressionOnConf(PigContext pigContext, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public static String getStringFromArray(String[] arr)
public static FuncSpec buildSimpleFuncSpec(String className, byte... types)
public static String slashisize(String str)
str
-
public static <O> Collection<O> mergeCollection(Collection<O> a, Collection<O> b)
public static InputStream getCompositeStream(InputStream in, Properties properties)
public static void recomputeProperties(org.apache.hadoop.mapred.JobConf jobConf, Properties properties)
conf
- JobConf with appropriate hadoop resource filesproperties
- Pig properties that will override hadoop properties;
properties might be modifiedpublic static String getStackStraceStr(Throwable e)
public static boolean isLocal(PigContext pigContext, org.apache.hadoop.conf.Configuration conf)
public static String substituteVars(String expr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |