Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Row level transformations using map
- val orders = sc.textFile("/public/retail_db/orders")
- // 21,2013-07-25 00:00:00.0,11599,CLOSED -> 20130725 as Int
- val str = orders.first
- str.split(",")(1).substring(0, 10).replace("-", "").toInt
- val orderDates = orders.map((str: String) => {
- str.split(",")(1).substring(0, 10).replace("-", "").toInt
- })
- val ordersPairedRDD = orders.map(order => {
- val o = order.split(",")
- (o(0).toInt, o(1).substring(0, 10).replace("-", "").toInt)
- })
- val orderItems = sc.textFile("/public/retail_db/order_items")
- val orderItemsPairedRDD = orderItems.map(orderItem => {
- (orderItem.split(",")(1).toInt, orderItem)
- })
Add Comment
Please, Sign In to add comment