Skip to Main Content
Modern Scala Projects
book

Modern Scala Projects

by Ilango gurusamy
July 2018
Intermediate to advanced content levelIntermediate to advanced
334 pages
8h 20m
English
Packt Publishing
Content preview from Modern Scala Projects

Step 5 – building a weapon sales order dataframe

Let's invoke the read method on our SparkSession instance and cache it. We will call this method later from the RecSystem object: 

def buildSalesOrders(dataSet: String): DataFrame = {  session.read    .format("com.databricks.spark.csv")    .option("header", true).schema(salesOrderSchema).option("nullValue", "")    .option("treatEmptyValuesAsNulls", "true")    .load(dataSet).cache()}

Next up, let's build a sales leads dataframe:

def buildSalesLeads(dataSet: String): DataFrame = {  session.read    .format("com.databricks.spark.csv")    .option("header", true).schema(salesLeadSchema).option("nullValue", "")    .option("treatEmptyValuesAsNulls", "true")    .load(dataSet).cache()}

This completes the trait. Overall, it looks ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scala Programming Projects

Scala Programming Projects

Mikael Valot, Nicolas Jorand

Publisher Resources

ISBN: 9781788624114Supplemental Content