Created
March 28, 2021 02:13
-
-
Save echang0929/bd49fcd9af339ba97deb0bae81973e43 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": "direct-campbell", | |
| "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:4042\">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@6f511b76\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.1.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.1.1`\n", | |
| "import org.apache.spark.mllib.linalg.{Matrix, Matrices}\n", | |
| "\n", | |
| "Matrices.dense(3, 2, Array(1, 3, 5, 2, 4, 6))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "presidential-apparatus", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "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