Created
September 10, 2019 13:18
-
-
Save dgadiraju/47296d372d644257fff50de181deafa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val orderCustomers1 = sc.textFile("/public/retail_db/orders"). | |
filter(o => o.split(",")(1).contains("2013-08")). | |
map(o => o.split(",")(2).toInt) | |
val orderCustomers2 = sc.textFile("/public/retail_db/orders"). | |
filter(o => o.split(",")(1).contains("2013-09")). | |
map(o => o.split(",")(2).toInt) | |
val customers = sc.textFile("/public/retail_db/customers"). | |
map(c => (c.split(",")(0).toInt, c)) | |
orderCustomers1. | |
subtract(orderCustomers2). | |
take(10). | |
foreach(println) | |
orderCustomers1. | |
subtract(orderCustomers2). | |
count | |
orderCustomers1. | |
subtract(orderCustomers2). | |
distinct. | |
count | |
orderCustomers1. | |
subtract(orderCustomers2). | |
distinct. | |
map(c => (c, 1)). | |
join(customers). | |
map(c => c._2._2). | |
take(10). | |
foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment