Scala/Spark 中的图形帧错误



我在 Scala 2.11 中将以下代码行写入 Databricks:

import org.graphframes._
val user_ridotto = sqlContext.sql("SELECT * FROM userRidotto")
var users_1 = user_ridotto.select("user_id", "name", "city", "num_fr",  
"fans", "review_count", "importance").withColumnRenamed("user_id", "id")
val users = users_1.withColumn("ridotto", lit("ridotto"))
var edges_1 = user_ridotto.select($"user_id" as "src", explode($"friends") 
as 
"dst", lit(1))
val graph_1 = GraphFrame(users, edges_1)
println("users: " + users.count + ", archi_1: " + edges_1.count)
val paths = graph_1.find("(a)-[e]->(b)")
.filter("a.ridotto='ridotto'")
.filter("b.ridotto='ridotto'")
val edges = paths.select("e.src", "e.dst")
val graph = GraphFrame(graph_1.vertices, edges)
println("users: " + users.count + ", archi: " + edges.count)

但它返回了我这些错误:

notebook:1: error: object graphframes is not a member of package org
import org.graphframes._
           ^
notebook:8: error: not found: value GraphFrame
val graph_1 = GraphFrame(users, edges_1)
          ^
notebook:15: error: not found: value GraphFrame
val graph = GraphFrame(graph_1.vertices, edges)

提前致谢真诚地安东尼奥

不是天真地放置的,所以你需要在库下导入jar文件。 您可以在工作区下导入文件(应该有一个消息框,允许您专门导入 JAR 文件),然后附加它。 附加后,需要重新启动群集

您可以在以下位置获取 JAR 文件: 图形框架

相关内容

  • 没有找到相关文章

最新更新