You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by ch...@apache.org on 2016/03/31 16:13:16 UTC

[6/6] incubator-toree git commit: A bit of more on the example notebook

A bit of more on the example notebook


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/f8f3022a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/f8f3022a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/f8f3022a

Branch: refs/heads/master
Commit: f8f3022aef68a2f6cea4bf665d89574358d0157b
Parents: 8dd92a1
Author: Gino Bustelo <lb...@apache.org>
Authored: Wed Mar 30 14:35:47 2016 -0500
Committer: Gino Bustelo <lb...@apache.org>
Committed: Wed Mar 30 14:35:47 2016 -0500

----------------------------------------------------------------------
 etc/examples/notebooks/sqlcontext_sharing.ipynb | 65 ++++++++++++++++++--
 1 file changed, 61 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/f8f3022a/etc/examples/notebooks/sqlcontext_sharing.ipynb
----------------------------------------------------------------------
diff --git a/etc/examples/notebooks/sqlcontext_sharing.ipynb b/etc/examples/notebooks/sqlcontext_sharing.ipynb
index 7213c19..be40dab 100644
--- a/etc/examples/notebooks/sqlcontext_sharing.ipynb
+++ b/etc/examples/notebooks/sqlcontext_sharing.ipynb
@@ -4,7 +4,45 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "### Create a DataFrame in Scala"
+    "# SQLContext Sharing <a name=\"top\"></a>"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "This example shows how Toree enables sharing of the SQLContext across the variety of languages that it supports (Scala, Python, R, SQL). To demostrate, this notebook will load data using one language and read it from another. Refer to the [Spark documentation](http://spark.apache.org/docs/latest/sql-programming-guide.html) for details about the DataFrame and SQL APIs."
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "<div class=\"alert alert-info\" role=\"alert\" style=\"margin-top: 10px\">\n",
+    "<p><strong>Note</strong><p>\n",
+    "\n",
+    "<p>Due to an issue installing R and running it using DockerMachine, we are not able to show an example with R.</p>\n",
+    "</div>"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "**Table of Contents**\n",
+    "\n",
+    "1. [Create a DataFrame in Scala](#create-in-scala)\n",
+    "2. [Read DataFrame in Python](#read-in-python)\n",
+    "3. [Create a DataFrame in Python](#create-in-python)\n",
+    "4. [Read DataFrame in Scala](#read-in-scala)\n",
+    "5. [Read DataFrame in SQL](#read-in-sql)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Create a DataFrame in Scala <a name=\"create-in-scala\"></a><span style=\"float: right; font-size: 0.5em\"><a href=\"#top\">Top</a></span>"
    ]
   },
   {
@@ -24,7 +62,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "### Read DataFrame in Python"
+    "## Read DataFrame in Python <a name=\"read-in-python\"></a> <span style=\"float: right; font-size: 0.5em\"><a href=\"#top\">Top</a></span>"
    ]
   },
   {
@@ -44,7 +82,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "### Create a DataFrame in Python"
+    "## Create a DataFrame in Python <a name=\"create-in-python\"></a> <span style=\"float: right; font-size: 0.5em\"><a href=\"#top\">Top</a></span>"
    ]
   },
   {
@@ -65,7 +103,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "### Read DataFrame in Scala"
+    "## Read DataFrame in Scala <a name=\"read-in-scala\"></a><span style=\"float: right; font-size: 0.5em\"><a href=\"#top\">Top</a></span>"
    ]
   },
   {
@@ -79,6 +117,25 @@
     "val cars = sqlContext.table(\"cars\")\n",
     "cars.show()"
    ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Read DataFrame in SQL <a name=\"read-in-sql\"></a><span style=\"float: right; font-size: 0.5em\"><a href=\"#top\">Top</a></span>"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {
+    "collapsed": false
+   },
+   "outputs": [],
+   "source": [
+    "%%sql\n",
+    "select * from cars where manufacturer == 'Audi'"
+   ]
   }
  ],
  "metadata": {