cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Concurrent State Update from Worker Nodes Possible?

fperry
New Contributor

For a data processing pipeline I use structured streaming and arbitrary stateful processing. I was wondering if the partitioning over several worker nodes and thus updating the state from different worker nodes has to be considered (e.g. using a lock) when using applyInPandasWithState. Or is that handled automatically by PySpark and Databricks and abstracted away?

Thank you

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @fperryWhen using applyInPandasWithState in PySpark, updates to each groupโ€™s state are automatically saved ...1. The function you provide should take parameters (key, Iterator[pandas.DataFrame], state) and return another Iterator[pandas.DataFrame]. The grouping key(s) will be passed as a tuple of numpy data types (e.g., numpy.int32 and numpy.float64). As for partitioning and state updates across worker nodes, PySpark and Databricks handle this abstraction for you, so you donโ€™t need to manually manage locks or synchronization mechanisms. ๐Ÿ˜Š

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!