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

Flink Gelly - Type mismatch while creating graph

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

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

您似乎从 Gelly 的 Java API 中导入了 Graph。尝试使用 import org.apache.flink.graph.scala.Graph 导入 Graph 的 Scala 版本。这应该可以解决您的问题。