June 2018
Intermediate to advanced
330 pages
9h 47m
English
We will be leveraging our Python Databricks notebook, but we will include the following Scala cell. At the top level here's the flow of the code:
%scalapackage d3aimport org.apache.spark.sql._import com.databricks.backend.daemon.driver.EnhancedRDDFunctions.displayHTMLcase class Edge(src: String, dest: String, count: Long)case class Node(name: String)case class Link(source: Int, target: Int, value: Long)case class Graph(nodes: Seq[Node], links: Seq[Link])object graphs {val sqlContext = SQLContext.getOrCreate(org.apache.spark.SparkContext.getOrCreate())import sqlContext.implicits._def force(clicks: Dataset[Edge], height: Int = 100, width: Int = 960): Unit = { val data = clicks.collect() val nodes = (data.map(_.src) ++ data.map(_.dest)).map(_.replaceAll("_", ...