-
-
Save shivaram/4ff0a9c226dda2030507 to your computer and use it in GitHub Desktop.
Chris DataFrame demo
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 txnsRaw = sqlContext.load("./Customer_Transactions.parquet", "parquet") | |
val demo = sqlContext.load("./Customer_Demographics.parquet", "parquet") | |
val sample = sqlContext.load("./DM_Sample.parquet", "parquet") | |
val spendPerCust = txnsRaw.groupBy("cust_id").agg(txnsRaw.col("cust_id"), sum(txnsRaw.col("extended_price").as("spend"))) | |
val txnsPerCust = txnsRaw.groupBy("cust_id", "day_num").agg( | |
count(txnsRaw.col("sku").as("txns")), txnsRaw.col("cust_id"), txnsRaw.col("day_num")) | |
val joined = txnsPerCust.join(spendPerCust, txnsPerCust("cust_id") === spendPerCust("cust_id"), "inner") | |
// This creates 40k tasks with over a gigabyte of data and takes forever | |
joined.count() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment