September 2018
Intermediate to advanced
398 pages
9h 43m
English
In this section, we are going to create a basic Dataset and draw a chart of its data.
In a new paragraph, add the following:
case class Demo(id: String, data: Int)val data = List( Demo("a",1), Demo("a",2), Demo("b",8), Demo("c",4))val dataDS = data.toDS()dataDS.createOrReplaceTempView("demoView")
We define a Demo class with id and a data property, then we create a list of different Demo objects and convert it into Dataset.
From the dataDS dataset ,we call the .createOrReplaceTempView("demoView") method. This function is going to register the dataset as a temporary view. With this view defined, we can use SQL to query this dataset. We can try it by adding in a new paragraph, as follows:
%sqlselect * from demoView
The newly created ...
Read now
Unlock full access