Package org.apache.parquet.hadoop.util
Class ContextUtil
java.lang.Object
org.apache.parquet.hadoop.util.ContextUtil
Utility methods to allow applications to deal with inconsistencies between
MapReduce Context Objects API between hadoop-0.20 and later versions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.conf.ConfigurationgetConfiguration(org.apache.hadoop.mapreduce.JobContext context) Invoke getConfiguration() method on JobContext.static org.apache.hadoop.mapreduce.CountergetCounter(org.apache.hadoop.mapreduce.TaskAttemptContext context, String groupName, String counterName) static booleanhasCounterMethod(org.apache.hadoop.mapreduce.TaskAttemptContext context) static voidincrementCounter(org.apache.hadoop.mapreduce.Counter counter, long increment) static org.apache.hadoop.mapreduce.CounternewGenericCounter(String name, String displayName, long value) static org.apache.hadoop.mapreduce.JobContextnewJobContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.JobID jobId) Creates JobContext from a JobConf and jobId using the correct constructor for based on Hadoop version.static org.apache.hadoop.mapreduce.TaskAttemptContextnewTaskAttemptContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptId) Creates TaskAttemptContext from a JobConf and jobId using the correct constructor for based on Hadoop version.
-
Constructor Details
-
ContextUtil
public ContextUtil()
-
-
Method Details
-
newJobContext
public static org.apache.hadoop.mapreduce.JobContext newJobContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.JobID jobId) Creates JobContext from a JobConf and jobId using the correct constructor for based on Hadoop version.jobIdcould be null.- Parameters:
conf- a configurationjobId- a job id- Returns:
- a job context
-
newTaskAttemptContext
public static org.apache.hadoop.mapreduce.TaskAttemptContext newTaskAttemptContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptId) Creates TaskAttemptContext from a JobConf and jobId using the correct constructor for based on Hadoop version.- Parameters:
conf- a configurationtaskAttemptId- a task attempt id- Returns:
- a task attempt context
-
newGenericCounter
public static org.apache.hadoop.mapreduce.Counter newGenericCounter(String name, String displayName, long value) - Parameters:
name- a string namedisplayName- a string display namevalue- an initial value- Returns:
- with Hadoop 2 :
new GenericCounter(args),
with Hadoop 1 :new Counter(args)
-
getConfiguration
public static org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.mapreduce.JobContext context) Invoke getConfiguration() method on JobContext. Works with both Hadoop 1 and 2.- Parameters:
context- a job context- Returns:
- the context's configuration
-
getCounter
-
hasCounterMethod
public static boolean hasCounterMethod(org.apache.hadoop.mapreduce.TaskAttemptContext context) -
incrementCounter
public static void incrementCounter(org.apache.hadoop.mapreduce.Counter counter, long increment)
-