我是 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
导入 Scala 版本的 Graph
。这应该可以解决您的问题。
关于scala - Flink Gelly - 创建图表时类型不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35172487/