Skip to content

Spark Group By

Lecture 23: Group By In Spark🔗

Sample Data

image

Questions🔗

image

Salary per department using groupBy() image

Where do we use window functions?🔗

Suppose we need to find out the percentage of total salary from a particular dept that the person is earning. we can use window function to specify the total salary per department in the particular record itself like I've shown below. image

This way we dont need to perform a join.

image

Grouping by two columns🔗

image