Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Big Data Analytics with PySpark

You're reading from  Hands-On Big Data Analytics with PySpark

Product type Book
Published in Mar 2019
Publisher Packt
ISBN-13 9781838644130
Pages 182 pages
Edition 1st Edition
Languages
Concepts
Authors (2):
Rudy Lai Rudy Lai
Profile icon Rudy Lai
Bartłomiej Potaczek Bartłomiej Potaczek
Profile icon Bartłomiej Potaczek
View More author details

Table of Contents (15) Chapters

Preface Installing Pyspark and Setting up Your Development Environment Getting Your Big Data into the Spark Environment Using RDDs Big Data Cleaning and Wrangling with Spark Notebooks Aggregating and Summarizing Data into Useful Reports Powerful Exploratory Data Analysis with MLlib Putting Structure on Your Big Data with SparkSQL Transformations and Actions Immutable Design Avoiding Shuffle and Reducing Operational Expenses Saving Data in the Correct Format Working with the Spark Key/Value API Testing Apache Spark Jobs Leveraging the Spark GraphX API Other Books You May Enjoy

Saving data in plain text format

In this section, we will learn how to save data in plain text format. The following topics will be covered:

  • Saving data in plain text format
  • Loading plain text data
  • Testing

We will save our data in plain text format and investigate how to save it into the Spark directory. We will then load the plain text data, and then test and save it to check whether we can yield the same results code. This is our SavePlainText.scala file:

package com.tomekl007.chapter_4

import java.io.File

import com.tomekl007.UserTransaction
import org.apache.spark.sql.SparkSession
import org.apache.spark.{Partitioner, SparkContext}
import org.scalatest.{BeforeAndAfterEach, FunSuite}
import org.scalatest.Matchers._

import scala.reflect.io.Path

class SavePlainText extends FunSuite with BeforeAndAfterEach{
val spark: SparkContext = SparkSession.builder().master("local[2]"...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}