Skip to content
RED SAG Skills
mediumStudy question · answer published in Apache Spark interview questions, so no pointssparkspark-window-functions

Window sum when days repeat

With only orderBy in the window, what running_total values come out for these four rows (ordered as shown)?

# day, amount
# 1, 100
# 2, 50
# 2, 30
# 3, 20
w = Window.orderBy("day")
df.withColumn("running_total", F.sum("amount").over(w))
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions