flink-gelly类型不匹配

qaxu7uf2  于 2021-06-24  发布在  Flink
关注(0)|答案(1)|浏览(790)

我不熟悉apache flink和gelly,我使用scalaapi。我有一个顶点数据集和一个边数据集,我试图创建这样一个图:

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
e1xvtsh3

e1xvtsh31#

好像你进口了 Graph 来自gelly的JavaAPI。尝试导入的scala版本 Graph 使用 import org.apache.flink.graph.scala.Graph . 这会解决你的问题。

相关问题