【问题标题】:Java DSE GraphFrame API does not fully support going from GraphTraversal to DataFrameJava DSE GraphFrame API 不完全支持从 GraphTraversal 到 DataFrame
【发布时间】:2018-01-18 18:29:31
【问题描述】:

Java DSE GraphFrame API 不完全支持从GraphTraversal 到DataFrame。

以下GraphTraversal 到DataFrame 是可能的:

gf().E().df()

但这不是:

gf().E().hasLabel("foo").df()

这是因为hasLabel() 返回一个GraphTraversal 而不是com.datastax.bdp.graph.spark.graphframe.DseGraphTraversal 并且GraphTraversal 没有df() 方法。

根据docs,这应该是可能的

完成一次遍历并返回 DataFrame API 而不是列表 或迭代器使用 .df() 方法:

graph.V().df()

我正在使用dse-graph-frames:5.1.4 和dse-byos_2.11:5.1.4。

这是预期的吗?我真正想要的只是做一些图遍历并将其转换为 DataFrame。

【问题讨论】:

    标签: datastax-enterprise datastax-java-driver datastax-enterprise-graph


    【解决方案1】:

    它在 Scala 中按原样工作,在 Java 中您需要将转换添加到 DseGraphTraversal

    ((DseGraphTraversal)gf.E().hasLabel("foo")).df()
    

    我在这里给出了更长的答案Iterating a GraphTraversal with GraphFrame causes UnsupportedOperationException Row to Vertex conversion

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-27
      • 2018-01-18
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      • 2017-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多