SHARE
TWEET

Untitled

a guest Sep 20th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val orders = sc.textFile("/public/retail_db/orders")
  2. val ordersMap = orders.
  3.   map(o => (o.split(",")(0).toInt, o))
  4.  
  5. val orderItems = sc.textFile("/public/retail_db/order_items")
  6. val orderItemsMap = orderItems.
  7.   map(oi => (oi.split(",")(1).toInt, oi))
  8.  
  9. val ordersJoin = ordersMap.
  10.   join(orderItemsMap)
  11. val ordersLeftOuterJoin = ordersMap.
  12.   leftOuterJoin(orderItemsMap)
  13.  
  14. ordersJoin.count
  15. ordersLeftOuterJoin.count
  16.  
  17. ordersLeftOuterJoin.
  18.   take(100).
  19.   foreach(println)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top