GitHub user greghogan opened a pull request:
https://github.com/apache/flink/pull/5126
[FLINK-5506] [gelly] Fix CommunityDetection NullPointerException
## What is the purpose of the change
This fixes a regression which can result in `NullPointerException` when
running the `CommunityDetection` algorithm. When a new highest valued label had
a negative summed value the lookup was performed on the old label value which
did not necessarily exist in the dictionary.
## Brief change log
- replaced `Double.MIN_VALUE` with the intended (and original)
`-Double.MAX_VALUE`
- added `Graph#mapVertices` and `Graph#mapEdges` variants accepting
`TypeHint` rather than `TypeInformation`; this seemed useful when using Java 8
lambdas which require explicit type definition with OpenJDK
- added additional tests for `CommunityDetection`
## Verifying this change
`CommunityDetectionTest#testWithSingletonEdgeGraph` is a user supplied
example which fails without the bug fix.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / **no** / don't know)
- The runtime per-record code paths (performance sensitive): (yes /
**no** / don't know)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / **no**)
- If yes, how is the feature documented? (**not applicable** / docs /
JavaDocs / not documented)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/greghogan/flink
5506_communitydetection_nullpointerexception
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/5126.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #5126
----
commit 8d57371616a742ba29548192d5d8a4018cafd26b
Author: Greg Hogan <[email protected]>
Date: 2017-12-05T17:36:18Z
[hotfix] [gelly] Graph API mapVertices/mapEdges with TypeHint
commit 8c131b42cfa95df34333a9ca733c9337f75695ba
Author: Greg Hogan <[email protected]>
Date: 2017-12-05T17:38:50Z
[FLINK-5506] [gelly] Fix CommunityDetection NullPointerException
Double.MIN_VALUE != min(double)
----
---