【问题标题】:Graphframe error in Scala/SparkScala/Spark 中的图框错误
【发布时间】:2018-04-30 23:31:21
【问题描述】:

我在 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)

提前致谢 真挚地 安东尼奥

【问题讨论】:

    标签: scala apache-spark databricks graphframes


    【解决方案1】:

    该库没有自然加载,因此您需要在库下导入 jar 文件。您可以在工作空间下导入文件(应该有一个消息框允许您专门导入jar文件)然后附加它。附加后需要重启集群

    您可以在以下位置获取 jar 文件:graphframes

    【讨论】:

      猜你喜欢
      • 2018-01-29
      • 2015-09-13
      • 2021-03-21
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-19
      • 2014-11-17
      相关资源
      最近更新 更多