Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
hadoop如何知道流模式下的密钥类型_Hadoop_Mapreduce - Fatal编程技术网

hadoop如何知道流模式下的密钥类型

hadoop如何知道流模式下的密钥类型,hadoop,mapreduce,Hadoop,Mapreduce,在map之后和reduce之前,有一个排序阶段。在流模式下,hadoop如何知道您的密钥类型,并对其进行排序 比如说 输入文件格式 1990 1 1991 4 1992 5 ... map的结果有键199019911992…,hadoop是如何排序的?(数字排序或字母排序)在StreamJob中,映射输出键/值对指定为 idResolver.resolve(jobConf_.get("stream.map.output", IdentifierResolver.TEXT_

在map之后和reduce之前,有一个排序阶段。在流模式下,hadoop如何知道您的密钥类型,并对其进行排序

比如说

输入文件格式

1990    1
1991    4
1992    5
...

map的结果有键199019911992…,hadoop是如何排序的?(数字排序或字母排序)

在StreamJob中,映射输出键/值对指定为

idResolver.resolve(jobConf_.get("stream.map.output",
  IdentifierResolver.TEXT_ID));
jobConf_.setClass("stream.map.output.reader.class",
  idResolver.getOutputReaderClass(), OutputReader.class);
jobConf_.setMapOutputKeyClass(idResolver.getOutputKeyClass());
jobConf_.setMapOutputValueClass(idResolver.getOutputValueClass());
除非,
stream.map.output
属性设置为
rawbytes
typedbytes
,否则映射输出键/值在IdentifierResolver#resolve中设置为Text.class

在Text.java中,Comparator子类扩展了WritableComparator,并实现了按字典顺序(字典或字母顺序)进行比较的compare方法

检查、和类

setOutputKeyClass(Text.class);
setOutputValueClass(Text.class);