I have a clear view of how Spark splits data to partitions within executors, then each partition is processed and then aggregated until a final "logical" dataframe.
However using windows, I feel like each window data should be in a single partition, so that each executor have all its data locally? Or is data still splitted, and then aggregated with a kind of magic?
An example of such Window is:
val window = Window
.partitionBy("partition-col")
.orderBy("order-col")
.rowsBetween(Window.unboundedPreceding, Window.unboundedFollowing)
myDF.withColumn("sum", sum("aCol").over(window))
How does Spark handle this? How performant is it to use windows?
What if I process, let's say 50 columns from a Window? May it generate a lot of network exchange, or will each window be processed locally?