You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mahout.apache.org by "Shangru Li (Jira)" <ji...@apache.org> on 2020/03/03 00:46:00 UTC
[jira] [Updated] (MAHOUT-2096) next() Called On Possible Empty
iterator()
[ https://issues.apache.org/jira/browse/MAHOUT-2096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shangru Li updated MAHOUT-2096:
-------------------------------
Description:
Consider this function:
{quote}
protected void reduce ( VarIntWritable index, Iterable<VarLongWritable> ids, Context
ctx) throws IOException, InterruptedException {
ctx.write(index, ids.iterator().next());
}
{quote}
The line `_ctx.write(index, ids.iterator().next());_` does not check for empty iterator when calling the next() function, which could result in an exception.
Function can be found on the GitHub repository [here|[https://github.com/apache/mahout/blob/754068bc3ac62bcf4b9b656cd4a6f413b29b18df/community/mahout-mr/mr/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java#L395]]
Line 395, in file _/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java_
was:
Consider this function:
{quote}
protected void reduce ( VarIntWritable index, Iterable<VarLongWritable> ids, Context
ctx) throws IOException, InterruptedException {
ctx.write(index, ids.iterator().next());
}
{quote}
The line `_ctx.write(index, ids.iterator().next());_` does not check for empty iterator when calling the next() function, which could result in an exception.
Function can be found on the GitHub repository [here|[https://github.com/apache/mahout/blob/754068bc3ac62bcf4b9b656cd4a6f413b29b18df/community/mahout-mr/mr/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java#L395].]
Line 395, in file _/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java_
> next() Called On Possible Empty iterator()
> ------------------------------------------
>
> Key: MAHOUT-2096
> URL: https://issues.apache.org/jira/browse/MAHOUT-2096
> Project: Mahout
> Issue Type: Bug
> Components: Algorithms
> Reporter: Shangru Li
> Priority: Minor
> Labels: easyfix, newbie
>
> Consider this function:
> {quote}
> protected void reduce ( VarIntWritable index, Iterable<VarLongWritable> ids, Context
> ctx) throws IOException, InterruptedException {
> ctx.write(index, ids.iterator().next());
> }
> {quote}
> The line `_ctx.write(index, ids.iterator().next());_` does not check for empty iterator when calling the next() function, which could result in an exception.
> Function can be found on the GitHub repository [here|[https://github.com/apache/mahout/blob/754068bc3ac62bcf4b9b656cd4a6f413b29b18df/community/mahout-mr/mr/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java#L395]]
>
> Line 395, in file _/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java_
--
This message was sent by Atlassian Jira
(v8.3.4#803005)