invoiceDF.printSchema () returns the following output: root |--InvoiceNo: string (nullable = true) |-- StockCode: string (nullable = true) |-- Description: string (nullable = true) |-- Quantity: integer (nullable = true) |-- InvoiceTimestamp: timestamp (nullable = true) 1 UnitPrice: double (nullable = true) |-- CustomerID: double (nullable = true) |--Region: string (nullable = true) Present the Scala source code to implement the following queries on invoiceDF: (a) return the total number of rows, (b) return the number of unique stock codes, (c) return the average unit price per stock code and (d) returning the number of invoices per customer ID.
invoiceDF.printSchema () returns the following output: root |--InvoiceNo: string (nullable = true) |-- StockCode: string (nullable = true) |-- Description: string (nullable = true) |-- Quantity: integer (nullable = true) |-- InvoiceTimestamp: timestamp (nullable = true) 1 UnitPrice: double (nullable = true) |-- CustomerID: double (nullable = true) |--Region: string (nullable = true) Present the Scala source code to implement the following queries on invoiceDF: (a) return the total number of rows, (b) return the number of unique stock codes, (c) return the average unit price per stock code and (d) returning the number of invoices per customer ID.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 4E
Related questions
Question
![Assume that a file called invoiceDF is created in Spark shell. Calling
invoiceDF.printSchema () returns the following output:
root
|--InvoiceNo: string (nullable = true)
|-- StockCode: string (nullable = true)
|-- Description: string (nullable = true)
-- Quantity: integer (nullable = true)
|-- InvoiceTimestamp: timestamp (nullable = true)
|-- UnitPrice: double (nullable = true)
|-- CustomerID: double (nullable = true)
|-- Region: string (nullable = true)
Present the Scala source code to implement the following queries on invoiceDF: (a) return
the total number of rows, (b) return the number of unique stock codes, (c) return the average
unit price per stock code and (d) returning the number of invoices per customer ID.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5f6f5828-6516-4e4e-a560-437af6f97761%2Fc0ec8764-2b46-44d2-8760-b7ed19b67f7f%2Fx9p2vyj_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Assume that a file called invoiceDF is created in Spark shell. Calling
invoiceDF.printSchema () returns the following output:
root
|--InvoiceNo: string (nullable = true)
|-- StockCode: string (nullable = true)
|-- Description: string (nullable = true)
-- Quantity: integer (nullable = true)
|-- InvoiceTimestamp: timestamp (nullable = true)
|-- UnitPrice: double (nullable = true)
|-- CustomerID: double (nullable = true)
|-- Region: string (nullable = true)
Present the Scala source code to implement the following queries on invoiceDF: (a) return
the total number of rows, (b) return the number of unique stock codes, (c) return the average
unit price per stock code and (d) returning the number of invoices per customer ID.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,