Flink Gelly - 创建图形时类型不匹配

时间:2016-02-03 09:00:51

标签: scala apache-flink gelly

我是Apache Flink和Gelly的新手,我使用的是Scala API。我有一个顶点的DataSet和一个边的DataSet,我试图创建一个这样的图:

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)

我收到以下错误:

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 个答案:

答案 0 :(得分:2)

看起来好像是从Gelly的Java API导入Graph。尝试使用Graph导入import org.apache.flink.graph.scala.Graph的Scala版本。这应该可以解决你的问题。