cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Window function + Multiple simultaneous aggregations

KarthikeyanB
New Contributor II

Hi team,

Why is there no support to perform multiple aggregations together with a single window spec? ie I dont want to specify each aggregation separately and I don't want to see each aggregation perform as a separate piece of work.

Or if there is indeed a way (other than say UDF), please do enlighten me.

Please advise.

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz_Fatma
Community Manager
Community Manager

Hi @Karthikeyan Balachandran​ , In Apache Spark™, the window functions allow you to perform multiple aggregations using a single window specification. By defining various aggregations within the exact window specification, you can avoid separate computations for each aggregation.

View solution in original post

3 REPLIES 3

Kaniz_Fatma
Community Manager
Community Manager

Hi @Karthikeyan Balachandran​ , In Apache Spark™, the window functions allow you to perform multiple aggregations using a single window specification. By defining various aggregations within the exact window specification, you can avoid separate computations for each aggregation.

KarthikeyanB
New Contributor II

Hi @Kaniz Fatma​ ,

Firstly, thank you much for responding.

Thank you for confirming that performing multiple aggr using a single window spec does NOT evaluate the window spec separately each time. My bad in the wrong understanding prior.

@Karthikeyan Balachandran​​ , Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question. Share the wisdom! By marking the best answers, you allow others in our community to find valuable data quickly and efficiently.