我试图使用mapreduce找到每个小部件的平均值。作业成功完成,但在使用hadoop fs -cat user / vagrant / example-1 / part-r-00000
时没有输出Route::get('/', function () {
if(auth()->user()->type == 2) { //if user type is 1 then it's an admin.
return redirect()->route('web-admin');
} else {
return redirect()->route('home');
}
})->middleware('auth');
Auth::routes();
Route::middleware('auth')->group(function() {
Route::get('home',['as'=>'home', 'uses'=>'HomeController@index']);
Route::get('web-admin',['as'=>'web-admin', 'uses'=>'Admin\Start@index']);
});
}
public static class MaxWidgetReducer
extends Reducer<Text, FloatWritable, FloatWritable, NullWritable> {
public void reduce(Text k, Iterable<FloatWritable> vals, Context context)
throws IOException, InterruptedException {
Float totalPrice = 0.0f;
Float avgPrice = 0.0f;
Integer count = null;
for (FloatWritable w : vals) {
totalPrice = (totalPrice + w.get());
count++;
}
答案 0 :(得分:0)
我强烈建议您在mapper和reducer中使用try / catch块,这样您就可以知道它是否是由于处理数据时抛出异常,尝试将w.get()强制转换为float为了能够将该值添加到总价格中。
干杯。