Flink Gelly - Type mismatch while creating graph

196 views Asked by At

I am new to Apache Flink and Gelly and I use the Scala API. I hava a DataSet of vertices and a DataSet of edges and I am trying to create a graph like this:

val env = ExecutionEnvironment.getExecutionEnvironment
// correct result
val edges: DataSet[Edge[Long, Long]] = (some transformations here)
//also correct result
val vertices: DataSet[Vertex[Long, String]] = (some transformations here)
//in the line below I get the errors
val graph = Graph.fromDataSet(vertices, edges, env)

And I get the following errors:

Type mismatch,expected: 
  DataSet[Vertex[NotInferedK,NotInferedVV]], actual: DataSet[Vertex[Long,String]]

Type mismatch,expected: 
  DataSet[Edges[NotInferedK,NotInferedEV]], actual: DataSet[Edge[Long,Long]]

Type mismatch,expected: 
  org.apache.flink.api.java.ExecutionEnvironment, actual: org.apache.flink.api.scala.ExecutionEnvironment
1

There are 1 answers

2
Till Rohrmann On BEST ANSWER

It looks as if you imported Graph from Gelly's Java API. Try to import the Scala version of Graph using import org.apache.flink.graph.scala.Graph. This should fix your problem.