1

The Java DSE GraphFrame API does not fully support going from GraphTraversal to DataFrame.

The following GraphTraversal to DataFrame is possible:

gf().E().df()

However this does not:

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

This is because hasLabel() returns a GraphTraversal instead of com.datastax.bdp.graph.spark.graphframe.DseGraphTraversal and GraphTraversal does not have the df() method.

This should be possible per the docs

To finish a traversal and return to the DataFrame API instead of list or iterator use the .df() method:

graph.V().df()

I'm using dse-graph-frames:5.1.4 along with dse-byos_2.11:5.1.4.

Is this expected? All I really want is to do some graph traversal and convert it into a DataFrame.

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Glide
  • 20,235
  • 26
  • 86
  • 135

1 Answers1

5

It works in Scala as is, in Java you need to add the cast to DseGraphTraversal

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

I gave a longer answer here Iterating a GraphTraversal with GraphFrame causes UnsupportedOperationException Row to Vertex conversion

Artem Aliev
  • 1,362
  • 7
  • 12