mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-11 12:02:56 +00:00
44 lines
942 B
Plaintext
44 lines
942 B
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"library(sparklyr)\n",
|
|
"\n",
|
|
"# get the default config\n",
|
|
"conf <- spark_config()\n",
|
|
"# Set the catalog implementation in-memory\n",
|
|
"conf$spark.sql.catalogImplementation <- \"in-memory\"\n",
|
|
"\n",
|
|
"# Spark session & context\n",
|
|
"sc <- spark_connect(master = \"local\", config = conf)\n",
|
|
"\n",
|
|
"# Sum of the first 100 whole numbers\n",
|
|
"sdf_len(sc, 100, repartition = 1) %>% \n",
|
|
" spark_apply(function(e) sum(e))\n",
|
|
"# 5050"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "R",
|
|
"language": "R",
|
|
"name": "ir"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": "r",
|
|
"file_extension": ".r",
|
|
"mimetype": "text/x-r-source",
|
|
"name": "R",
|
|
"pygments_lexer": "r",
|
|
"version": "3.6.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|