[
https://issues.apache.org/jira/browse/NUTCH-2375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16166479#comment-16166479
]
ASF GitHub Bot commented on NUTCH-2375:
---------------------------------------
sebastian-nagel commented on a change in pull request #221: NUTCH-2375
Upgrading nutch to use org.apache.hadoop.mapreduce
URL: https://github.com/apache/nutch/pull/221#discussion_r138928596
##########
File path: src/java/org/apache/nutch/scoring/webgraph/LinkRank.java
##########
@@ -284,64 +293,72 @@ private void runAnalysis(Path nodeDb, Path inverted,
Path output,
* This is used to determine a rank one score for pages with zero inlinks but
* that contain outlinks.
*/
- private static class Counter implements
- Mapper<Text, Node, Text, LongWritable>,
- Reducer<Text, LongWritable, Text, LongWritable> {
+ private static class Counter {
private static Text numNodes = new Text(NUM_NODES);
private static LongWritable one = new LongWritable(1L);
- public void configure(JobConf conf) {
- }
-
/**
* Outputs one for every node.
*/
- public void map(Text key, Node value,
- OutputCollector<Text, LongWritable> output, Reporter reporter)
- throws IOException {
- output.collect(numNodes, one);
+ public static class CountMapper extends
+ Mapper<Text, Node, Text, LongWritable> {
+ public void setup(Mapper<Text, Node, Text, LongWritable>.Context
context) {
+ }
+
+ public void map(Text key, Node value,
+ Context context)
+ throws IOException, InterruptedException {
+ context.write(numNodes, one);
+ }
}
/**
* Totals the node number and outputs a single total value.
*/
- public void reduce(Text key, Iterator<LongWritable> values,
- OutputCollector<Text, LongWritable> output, Reporter reporter)
- throws IOException {
+ public static class CountReducer extends
+ Reducer<Text, LongWritable, Text, LongWritable> {
+ public void setup(Reducer<Text, LongWritable, Text,
LongWritable>.Context context) {
+ }
- long total = 0;
- while (values.hasNext()) {
- total += values.next().get();
+ public void reduce(Text key, Iterable<LongWritable> values,
+ Context context)
+ throws IOException, InterruptedException {
+
+ long total = 0;
+ for (LongWritable val : values) {
+ total += val.get();
+ }
+ context.write(numNodes, new LongWritable(total));
}
- output.collect(numNodes, new LongWritable(total));
}
public void close() {
}
}
- private static class Initializer implements Mapper<Text, Node, Text, Node> {
+ private static class Initializer extends Mapper<Text, Node, Text, Node> {
- private JobConf conf;
- private float initialScore = 1.0f;
+ private static Configuration conf;
+ private static float initialScore = 1.0f;
Review comment:
Why static?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Upgrade the code base from org.apache.hadoop.mapred to
> org.apache.hadoop.mapreduce
> ----------------------------------------------------------------------------------
>
> Key: NUTCH-2375
> URL: https://issues.apache.org/jira/browse/NUTCH-2375
> Project: Nutch
> Issue Type: Improvement
> Components: deployment
> Reporter: Omkar Reddy
>
> Nutch is still using the deprecated org.apache.hadoop.mapred dependency which
> has been deprecated. It need to be updated to org.apache.hadoop.mapreduce
> dependency.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)