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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 4E
icon
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.
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
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,