[
https://issues.apache.org/jira/browse/NUTCH-2535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401610#comment-16401610
]
ASF GitHub Bot commented on NUTCH-2535:
---------------------------------------
sebastian-nagel closed pull request #296: NUTCH-2535 fix ClassCastException
CrawlDbReader -stats
URL: https://github.com/apache/nutch/pull/296
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/java/org/apache/nutch/crawl/CrawlDbReader.java
b/src/java/org/apache/nutch/crawl/CrawlDbReader.java
index db6a7d12e..9be246a58 100644
--- a/src/java/org/apache/nutch/crawl/CrawlDbReader.java
+++ b/src/java/org/apache/nutch/crawl/CrawlDbReader.java
@@ -250,16 +250,16 @@ public void reduce(Text key, Iterable<NutchWritable>
values,
|| k.equals("ftt") || k.equals("fit")) {
// sum all values for this key
long sum = 0;
- for (Writable value : values) {
- sum += ((LongWritable) value).get();
+ for (NutchWritable value : values) {
+ sum += ((LongWritable) value.get()).get();
}
// output sum
context.write(key, new NutchWritable(new LongWritable(sum)));
} else if (k.equals("sc")) {
float min = Float.MAX_VALUE;
float max = Float.MIN_VALUE;
- for (Writable temp_value : values) {
- float value = ((FloatWritable) temp_value).get();
+ for (NutchWritable nvalue : values) {
+ float value = ((FloatWritable) nvalue.get()).get();
if (max < value) {
max = value;
}
@@ -272,8 +272,8 @@ public void reduce(Text key, Iterable<NutchWritable> values,
} else if (k.equals("ft") || k.equals("fi")) {
long min = Long.MAX_VALUE;
long max = Long.MIN_VALUE;
- for (Writable temp_value : values) {
- long value = ((LongWritable) temp_value).get();
+ for (NutchWritable nvalue : values) {
+ long value = ((LongWritable) nvalue.get()).get();
if (max < value) {
max = value;
}
@@ -285,14 +285,15 @@ public void reduce(Text key, Iterable<NutchWritable>
values,
context.write(key, new NutchWritable(new LongWritable(max)));
} else if (k.equals("sct")) {
float cnt = 0.0f;
- for (Writable temp_value : values) {
- float value = ((FloatWritable) temp_value).get();
+ for (NutchWritable nvalue : values) {
+ float value = ((FloatWritable) nvalue.get()).get();
cnt += value;
}
context.write(key, new NutchWritable(new FloatWritable(cnt)));
} else if (k.equals("scd")) {
MergingDigest tdigest = null;
- for (Writable value : values) {
+ for (NutchWritable nvalue : values) {
+ Writable value = nvalue.get();
if (value instanceof BytesWritable) {
byte[] bytes = ((BytesWritable) value).getBytes();
MergingDigest tdig = MergingDigest
----------------------------------------------------------------
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]
> CrawlDbReader -stats: ClassCastException
> ----------------------------------------
>
> Key: NUTCH-2535
> URL: https://issues.apache.org/jira/browse/NUTCH-2535
> Project: Nutch
> Issue Type: Bug
> Components: crawldb
> Affects Versions: 1.15
> Reporter: Sebastian Nagel
> Priority: Major
> Fix For: 1.15
>
>
> {noformat}
> java.lang.Exception: java.lang.ClassCastException:
> org.apache.nutch.crawl.NutchWritable cannot be cast to
> org.apache.hadoop.io.LongWritable
> at
> org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
> at
> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
> Caused by: java.lang.ClassCastException: org.apache.nutch.crawl.NutchWritable
> cannot be cast to org.apache.hadoop.io.LongWritable
> at
> org.apache.nutch.crawl.CrawlDbReader$CrawlDbStatReducer.reduce(CrawlDbReader.java:254)
> at
> org.apache.nutch.crawl.CrawlDbReader$CrawlDbStatReducer.reduce(CrawlDbReader.java:237)
> at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:171)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)