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

feat: add example of pyspark to scan data from ngql #56

Merged
merged 1 commit into from
Feb 23, 2023
Merged
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
feat: add example of pyspark to scan data from ngql
wey-gu committed Feb 23, 2023
commit bcd3c6a62a48512a2b7541f9c5d8b20510bb9f2e
25 changes: 23 additions & 2 deletions spark/pagerank_example.ipynb
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@
"metadata": {},
"outputs": [],
"source": [
"# option 0: read graph data for one type of edge, scan from all storaged instances\n",
"df = spark.read.format(\n",
" \"com.vesoft.nebula.connector.NebulaDataSource\").option(\n",
" \"type\", \"edge\").option(\n",
@@ -46,9 +47,29 @@
" \"returnCols\", \"degree\").option(\n",
" \"metaAddress\", \"metad0:9559\").option(\n",
" \"partitionNumber\", 1).load()\n",
"\n",
"# option 1: read graph data with ngql, get data from graphd\n",
"df = spark.read.format(\n",
" \"com.vesoft.nebula.connector.NebulaDataSource\").option(\n",
" \"type\", \"edge\").option(\n",
" \"spaceName\", \"basketballplayer\").option(\n",
" \"label\", \"follow\").option(\n",
" \"returnCols\", \"degree\").option(\n",
" \"metaAddress\", \"metad0:9559\").option(\n",
" \"graphAddress\", \"graphd:9669\").option(\n",
" \"ngql\", \"MATCH ()-[e:follow]->() return e LIMIT 1000\").option(\n",
" \"partitionNumber\", 1).load()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31871548",
"metadata": {},
"outputs": [],
"source": [
"# prConfig = PRConfig(3, 0.85)\n",
"prConfig = spark._jvm.PRConfig(3, 0.85)\n",
"\n"
"prConfig = spark._jvm.PRConfig(3, 0.85)"
]
},
{