Last active
September 4, 2019 02:05
-
-
Save dgadiraju/b4054aa4b36fc4cdad0ef515b4a7d830 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 orders = sc.textFile("/public/retail_db/orders") | |
// Get COMPLETE orders | |
orders. | |
filter(o => o.split(",")(3) == "COMPLETE"). | |
take(10). | |
foreach(println) |
This file contains hidden or 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
// Get COMPLETE or CLOSED orders | |
orders. | |
filter(o => o.split(",")(3) == "COMPLETE" || o.split(",")(3) == "CLOSED"). | |
take(10). | |
foreach(println) | |
orders. | |
filter(o => List("COMPLETE", "CLOSED").contains(o.split(",")(3))). | |
take(10). | |
foreach(println) |
This file contains hidden or 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
// Get COMPLETE or CLOSED or any PENDING type orders | |
orders. | |
filter(o => { | |
List("COMPLETE", "CLOSED"). | |
contains(o.split(",")(3)) || | |
o.split(",")(3).contains("PENDING") | |
}). | |
take(10). | |
foreach(println) |
This file contains hidden or 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
// Get all the COMPLETE or CLOSED orders placed on 2013 August 15 | |
orders. | |
filter(o => { | |
List("COMPLETE", "CLOSED"). | |
contains(o.split(",")(3)) && | |
o.split(",")(1).startsWith("2013-08-15") | |
}). | |
take(10). | |
foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment