MapReduce之问题

13/03/18 15:26:20 INFO mapred.Task: Task:attempt_local_0001_m_000004_0 is done. And is in the process of commiting
13/03/18 15:26:20 INFO mapred.LocalJobRunner: hdfs://192.168.18.167:9000/vas/result/output/tms_DH0014-r-00000:0+191
13/03/18 15:26:20 INFO mapred.Task: Task 'attempt_local_0001_m_000004_0' done.
13/03/18 15:26:20 INFO mapred.Task:  Using ResourceCalculatorPlugin : null
13/03/18 15:26:20 INFO mapred.MapTask: numReduceTasks: 1
13/03/18 15:26:20 INFO mapred.MapTask: io.sort.mb = 100
13/03/18 15:26:20 INFO mapred.MapTask: data buffer = 79691776/99614720
13/03/18 15:26:20 INFO mapred.MapTask: record buffer = 262144/327680
13/03/18 15:26:20 INFO mapred.MapTask: Starting flush of map output
13/03/18 15:26:20 INFO mapred.MapTask: Finished spill 0
13/03/18 15:26:20 INFO mapred.Task: Task:attempt_local_0001_m_000005_0 is done. And is in the process of commiting
13/03/18 15:26:20 INFO mapred.LocalJobRunner: hdfs://192.168.18.167:9000/vas/result/output/tms_CA0014-r-00000:0+21
13/03/18 15:26:20 INFO mapred.Task: Task 'attempt_local_0001_m_000005_0' done.
13/03/18 15:26:20 INFO mapred.Task:  Using ResourceCalculatorPlugin : null
13/03/18 15:26:20 INFO mapred.LocalJobRunner: 
13/03/18 15:26:20 INFO mapred.Merger: Merging 6 sorted segments
13/03/18 15:26:20 INFO mapred.Merger: Down to the last merge-pass, with 6 segments left of total size: 1140458 bytes
13/03/18 15:26:20 INFO mapred.LocalJobRunner: 
13/03/18 15:26:26 INFO mapred.LocalJobRunner: reduce > reduce

13/03/18 15:26:26 INFO mapred.JobClient:  map 100% reduce 67%


执行到这个地方不动了,请问什么原因?

public void map(LongWritable key, Text value,
OutputCollector<Text, Text> output, Reporter reporter)
throws IOException {


// 将输入的纯文本文件的数据转化成String
String line = value.toString();

StringTokenizer tokenizerLine  = new StringTokenizer(line, ",");

tokenizerLine.nextToken();
String timeStr = tokenizerLine.nextToken().trim(); // 交易时间部分
String transTypeStr = tokenizerLine.nextToken().trim();// 交易类型部分


String timeString = timeStr.substring(0, 2) + timeStr.substring(3, 5);
int transTime = Integer.parseInt(timeString);


Text transType = new Text(transTypeStr);
for (int t = 0000; t <= 2400; t = t + TIME_SPACE) {
Text time = new Text(t+"");
if (transTime >= t && transTime <= t + TIME_SPACE) {
// 输出交易时间和交易类型
output.collect(time, transType);
continue;
}

String s = t + "";
if (t != 0 && s.substring(s.length()-2).equals("50")) {
t += 40;
}
}

static class TmReducer extends MapReduceBase implements
Reducer<Text, Text, Text, IntWritable> {


public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {


int count = 0;

while(values.hasNext()){
count ++;
}

output.collect(key, new IntWritable(count));
}

}

问题解决了:

while(values.hasNext()){
count ++;
}

自己写了一个死循环,真2.......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值