Skip to content

Commit

Permalink
update ngql reader example (#84)
Browse files Browse the repository at this point in the history
* update ngql reader example

* update match statement

* update match statement
  • Loading branch information
Nicole00 authored Feb 8, 2023
1 parent d144eb2 commit f5283ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ object NebulaSparkReaderExample {
readEdges(spark)
readVertexGraph(spark)
readEdgeGraph(spark)
readEdgeWithNgql(spark)

spark.close()
sys.exit()
Expand Down Expand Up @@ -178,11 +179,15 @@ object NebulaSparkReaderExample {
.builder()
.withSpace("test")
.withLabel("friend")
// please make sure you have config the NoColumn true or returnCols with at least one column.
//.withNoColumn(true)
.withReturnCols(List("degree"))
// please make sure your ngql statement result is edge, connector does not check the statement.
.withNgql("match (v)-[e:friend]-(v2) return e")
.build()
val edge = spark.read.nebula(config, nebulaReadConfig).loadEdgesToDfByNgql()
edge.printSchema()
edge.show(20)
println("veedgertex count: " + edge.count())
println("edge count: " + edge.count())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WriteInsertSuite extends AnyFunSuite with BeforeAndAfterAll {
test("write vertex into test_write_string space with insert mode") {
SparkMock.writeVertex()
val addresses: List[Address] = List(new Address("127.0.0.1", 9669))
val graphProvider = new GraphProvider(addresses, 3000)
val graphProvider = new GraphProvider(addresses, 3000)

graphProvider.switchSpace("root", "nebula", "test_write_string")
val createIndexResult: ResultSet = graphProvider.submit(
Expand All @@ -50,7 +50,7 @@ class WriteInsertSuite extends AnyFunSuite with BeforeAndAfterAll {
SparkMock.writeEdge()

val addresses: List[Address] = List(new Address("127.0.0.1", 9669))
val graphProvider = new GraphProvider(addresses, 3000)
val graphProvider = new GraphProvider(addresses, 3000)

graphProvider.switchSpace("root", "nebula", "test_write_string")
val createIndexResult: ResultSet = graphProvider.submit(
Expand All @@ -63,7 +63,7 @@ class WriteInsertSuite extends AnyFunSuite with BeforeAndAfterAll {

graphProvider.submit("use test_write_string;")
val resultSet: ResultSet =
graphProvider.submit("match (v:person_connector)-[e:friend_connector] -> () return e;")
graphProvider.submit("match (v:person_connector)-[e:friend_connector]-> () return e;")
assert(resultSet.isSucceeded)
assert(resultSet.getColumnNames.size() == 1)
assert(resultSet.getRows.size() == 13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class WriteInsertSuite extends AnyFunSuite with BeforeAndAfterAll {

graphProvider.submit("use test_write_string;")
val resultSet: ResultSet =
graphProvider.submit("match (v:person_connector)-[e:friend_connector] -> () return e;")
graphProvider.submit("match (v:person_connector)-[e:friend_connector]-> () return e;")
assert(resultSet.getColumnNames.size() == 1)
assert(resultSet.getRows.size() == 13)

Expand Down

0 comments on commit f5283ef

Please sign in to comment.