Till Rohrmann created FLINK-3036:
------------------------------------
Summary: Gelly's Graph.fromCsvReader method returns wrongly
parameterized Graph
Key: FLINK-3036
URL: https://issues.apache.org/jira/browse/FLINK-3036
Project: Flink
Issue Type: Bug
Components: Gelly
Affects Versions: 0.10.0
Reporter: Till Rohrmann
The Scala method {{Graph.fromCsvReader}} of Gelly returns a wrongly typed
{{Graph}} instance. The problem is that no return type has been explicitly
defined for the method. Additionally, the method returns fundamentally
incompatible types depending on the given parameters. So for example, the
method can return a {{Graph[Long, Long, Long]}} if a vertex and edge file is
specified (in this case with value type {{Long}}). If the vertex file is not
specified and neither a vertex value initializer, then the return type is
{{Graph[Long, NullValue, Long]}}. Since {{NullValue}} and {{Long}} have nothing
in common, Scala's type inference infers that the {{fromCsvReader}} method must
have a return type {{Graph[Long, t >: Long with NullValue, Long]}} with {{t}}
being a supertype of {{Long with NullValue}}. This type is not useful at all,
since there is no such type. As a consequence, the user has to cast the
resulting {{Graph}} to have either the type {{Graph[Long, NullValue, Long]}} or
{{Graph[Long, Long, Long]}} if he wants to do something more elaborate than
just collecting the edges for example.
This can be especially confusing because one usually writes something like
{code}
val graph = Graph.fromCsvReader[Long, Double, Double](...)
graph.run(new PageRank(...))
{code}
and does not see that the type of {{graph}} is {{Graph[Long, t >: Double with
NullValue, u >: Double with NullValue}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)