Class Platform
java.lang.Object
org.apache.hadoop.mapred.nativetask.Platform
Base class for platforms. A platform is a framework running on top of
MapReduce, like Hadoop, Hive, Pig, Mahout. Each framework defines its
own key type and value type across a MapReduce job. For each platform,
we should implement serializers such that we could communicate data with
native side and native comparators so our native output collectors could
sort them and write out. We've already provided the
HadoopPlatform
that supports all key types of Hadoop and users could implement their custom
platform.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanwhether it's the platform that has defined a custom Java comparator NativeTask doesn't support custom Java comparators (set with mapreduce.job.output.key.comparator.class) but a platform (e.g Pig) could also set that conf and implement native comparators so we shouldn't bail out.abstract voidinit()initialize a platform, where we should call registerKeyabstract Stringname()protected voidregisterKey(String keyClassName, Class<?> key) associate a key class with its serializer and platformprotected abstract booleansupport(String keyClassName, INativeSerializer<?> serializer, JobConf job) whether a platform supports a specific key should at least satisfy two conditions 1. the key belongs to the platform 2. the associated serializer must implementINativeComparableinterface
-
Field Details
-
keyClassNames
-
-
Constructor Details
-
Platform
public Platform()
-
-
Method Details
-
init
initialize a platform, where we should call registerKey- Throws:
IOException
-
name
- Returns:
- name of a Platform, useful for logs and debug
-
registerKey
associate a key class with its serializer and platform- Parameters:
keyClassName- map out key class namekey- key serializer class- Throws:
IOException
-
support
protected abstract boolean support(String keyClassName, INativeSerializer<?> serializer, JobConf job) whether a platform supports a specific key should at least satisfy two conditions 1. the key belongs to the platform 2. the associated serializer must implementINativeComparableinterface- Parameters:
keyClassName- map out put key class nameserializer- serializer associated with key via registerKeyjob- job configuration- Returns:
- true if the platform has implemented native comparators of the key and false otherwise
-
define
whether it's the platform that has defined a custom Java comparator NativeTask doesn't support custom Java comparators (set with mapreduce.job.output.key.comparator.class) but a platform (e.g Pig) could also set that conf and implement native comparators so we shouldn't bail out.- Parameters:
keyComparator- comparator set with mapreduce.job.output.key.comparator.class
-