Created
February 15, 2021 22:54
-
-
Save echang0929/26a39b5cde18497b8b9042bf08058875 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "id": "latter-ethernet", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Loading spark-stubs\n", | |
| "Getting spark JARs\n", | |
| "Creating SparkSession\n" | |
| ] | |
| }, | |
| { | |
| "name": "stderr", | |
| "output_type": "stream", | |
| "text": [ | |
| "Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<a target=\"_blank\" href=\"http://192.168.50.56:4040\">Spark UI</a>" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "\u001b[32mimport \u001b[39m\u001b[36morg.apache.log4j.{Level, Logger}\n", | |
| "\u001b[39m\n", | |
| "\u001b[32mimport \u001b[39m\u001b[36m$ivy.$ \n", | |
| "\u001b[39m\n", | |
| "\u001b[32mimport \u001b[39m\u001b[36morg.apache.spark.sql._\n", | |
| "\n", | |
| "\u001b[39m\n", | |
| "\u001b[36mspark\u001b[39m: \u001b[32mSparkSession\u001b[39m = org.apache.spark.sql.SparkSession@77df18a0\n", | |
| "defined \u001b[32mfunction\u001b[39m \u001b[36msc\u001b[39m\n", | |
| "\u001b[32mimport \u001b[39m\u001b[36m$ivy.$ \n", | |
| "\u001b[39m\n", | |
| "\u001b[32mimport \u001b[39m\u001b[36morg.apache.spark.mllib.linalg.{Matrix, Matrices}\n", | |
| "\n", | |
| "\u001b[39m\n", | |
| "\u001b[36mres0_8\u001b[39m: \u001b[32mMatrix\u001b[39m = 1.0 2.0 \n", | |
| "3.0 4.0 \n", | |
| "5.0 6.0 " | |
| ] | |
| }, | |
| "execution_count": 1, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "import org.apache.log4j.{Level, Logger}\n", | |
| "Logger.getLogger(\"org\").setLevel(Level.OFF)\n", | |
| "\n", | |
| "import $ivy.`org.apache.spark::spark-sql:3.0.1`\n", | |
| "import org.apache.spark.sql._\n", | |
| "\n", | |
| "val spark = {\n", | |
| " NotebookSparkSession.builder()\n", | |
| " .master(\"local[*]\")\n", | |
| " .getOrCreate()\n", | |
| "}\n", | |
| "\n", | |
| "def sc = spark.sparkContext\n", | |
| "\n", | |
| "import $ivy.`org.apache.spark::spark-mllib:3.0.1`\n", | |
| "import org.apache.spark.mllib.linalg.{Matrix, Matrices}\n", | |
| "\n", | |
| "Matrices.dense(3, 2, Array(1, 3, 5, 2, 4, 6))" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Scala", | |
| "language": "scala", | |
| "name": "scala" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": "text/x-scala", | |
| "file_extension": ".sc", | |
| "mimetype": "text/x-scala", | |
| "name": "scala", | |
| "nbconvert_exporter": "script", | |
| "version": "2.12.12" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 5 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment