dgadiraju
7/9/2017 - 3:41 AM

scala-spark-sql-totalrevenuedaily.sql

SET spark.sql.shuffle.partitions; //default 200
SET spark.sql.shuffle.partitions = 2;
SELECT o.order_date, sum(oi.order_item_subtotal) daily_revenue
      FROM orders o JOIN order_items oi
      ON o.order_id = oi.order_item_order_id
      WHERE o.order_status = 'COMPLETE'
      GROUP BY o.order_date
      ORDER BY o.order_date;