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:ย 

apply a function across multiple smaller dataframes created from one big dataframe in scala

Sandesh87
New Contributor III

The dataframe 'big_df' looks like the below

| id| index| timestamp|

|:---- |:------:| -----:|

| abc| 1| 11:00:00|

| abc| 1| 11:00:10|

| abc| 1| 11:00:20|

| abc| 1| 11:00:30|

| abc| 1| 11:00:40|

| abc| 1| 11:00:50|

| abc| 2| 11:01:00|

| abc| 2| 11:01:10|

| abc| 2| 11:01:20|

| def| 1| 23:00:00|

| def| 1| 23:01:00|

| xyz| 1| 15:00:00|

| xyz| 1| 15:01:00|

| xyz| 1| 15:02:00|

| xyz| 1| 15:03:00|

| xyz| 1| 15:04:00|

| xyz| 1| 15:05:00|

| xyz| 2| 15:06:00|

| xyz| 2| 15:07:00|

| xyz| 3| 15:10:00|

There is a function 'fun1' which takes a dataframe as input. 

Each unique combination of columns 'id' and 'index' in big_df is a small dataframe that needs to be passed to the function fun1. 

How can this function be applied across multiple of the small dataframes in parallel?

Can it be achieved using the foreachpartition and if so how?

1 REPLY 1

Anonymous
Not applicable

Hi @Sandesh Puligundlaโ€‹ 

Great to meet you, and thanks for your question!

Let's see if your peers in the community have an answer to your question. Thanks.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group