Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-3036

Gelly's Graph.fromCsvReader method returns wrongly parameterized Graph

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • None
    • None

    Description

      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

      val graph = Graph.fromCsvReader[Long, Double, Double](...)
      graph.run(new PageRank(...))
      

      and does not see that the type of graph is Graph[Long, t >: Double with NullValue, u >: Double with NullValue.

      Attachments

        Activity

          People

            trohrmann Till Rohrmann
            trohrmann Till Rohrmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: