pyspark-algorithms
pyspark-algorithms copied to clipboard
ADD NEW SQL SOLUTION
sales_SQL = spark.sql("""SELECT city, year, sum(amount) as amount
,GROUPING_ID(city, year) GFLG
FROM sales_tbl
GROUP BY ROLLUP(city, year)
HAVING 3 != GROUPING_ID(city, year)
ORDER BY city DESC NULLS LAST, year ASC NULLS LAST
""")