Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ngql reader example #84

Merged
merged 3 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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