Quantcast
Channel: 質問!ITmedia 新着質問(Java/253)
Viewing all articles
Browse latest Browse all 2439

mapreduceの方法(Java,Hadoop)

$
0
0
(緯度、経度、高度、日付)が何セットか入力されているデータから、Mapreduceを利用してある緯度経度を中心に、半径何メートル以内にあるデータを抽出して一時間ごとのデータの数をファイルに出力するというプログラムをJavaで書きたいです。 WordCountのサンプルプログラムを利用して自分なりに書き換えたのですが、完成出来ません。 2行目の<>内はどのように書き換えれば良いのでしょうか。テキストデータがあるWordCountとは異なり、数字だけのデータなのでStringやtextの代わりにDoubleを使えば良いのでしょうか。 その他、書き直さなければならない点を指摘して頂けると幸いです。 public static class TokenizerMapper        extends Mapper{     private final static IntWritable one = new IntWritable(1);     private Text word = new Text();     Query query = new Query();     //location(500m circle centred on a Microsoft office)     GeoLocation geo = new GeoLocation(0.000000,0.00000);     query.setGeoCode(geo, 500, Query.METERS);     public void map(Object key, Text value, Context context)   throws IOException, InterruptedException {       StringTokenizer itr = new StringTokenizer(value.toString()); // make StringTokenizer       while (itr.hasMoreTokens()) { // get a token         word.set(itr.nextToken()); // text type as key         context.write(word, one); // put 1 of IntWritable as value       }     }

Viewing all articles
Browse latest Browse all 2439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>