Replies: 8 comments 12 replies
-
@JkSelf I assume there are some easy cases, e.g. rank() over (partitioned by ... sorted by ... There are harder cases where the frame changes wildly from row to row and the function is such that it needs to access all or many or rows at the edges of the frame. In these cases spilling may not help. We'll need to repeatedly read data from disk while processing each row and that will be too slow to be useful. Therefore, I suggest to identify the "easy" cases and optimize the implementation of these cases to not require storing all rows of a partition in memory. |
Beta Was this translation helpful? Give feedback.
-
@JkSelf :
|
Beta Was this translation helpful? Give feedback.
-
@mbasmanova @aditi-pandit Thank you very much for your reply.
|
Beta Was this translation helpful? Give feedback.
-
@JkSelf : TopNRowNumber is not streaming. Yes, changes similar to StreamingWindow would be needed. |
Beta Was this translation helpful? Give feedback.
-
@mbasmanova @aditi-pandit Thank you for your replies.
|
Beta Was this translation helpful? Give feedback.
-
@JkSelf : Its interesting to know Spark is going further along in how much spilling it can handle. Looking at a sub-partition level, does Spark assume that atleast all rows of a frame should fit in memory ? If we had to handle the cases where even a frame might not fit in memory, then the algorithms get very complex. We would need to be able to handle random access of data in a spilled partition to make the implementation somewhat efficient. |
Beta Was this translation helpful? Give feedback.
-
@JkSelf @mbasmanova : I put together some notes about Window Partition spilling in doc https://ibm.ent.box.com/file/1481358566140?s=azyj3s8xgjyzdqqwv9q79yruj9xga6r7 Please give me your feedback on it. |
Beta Was this translation helpful? Give feedback.
-
@JkSelf : I started putting a doc together at https://docs.google.com/document/d/1ug_QAU4muSPqRZsBOanq--ECBUSzvIFDPov5R2XcdNs/edit?usp=sharing. But will be updating it over this week. I've been looking at your PR. I have some design in mind and we can work on it together to make joint progress if you are open to the idea. Would you do a video call with me sometime for more brainstorming ? |
Beta Was this translation helpful? Give feedback.
-
Because the
Window
operator inSpark
inserts anOrderBy
operation to sort the input data before execution, we don't need to sort again within theWindow
operator. Therefore, we previously addedStreamingWindowBuild
in Velox to support theWindow
operator in Spark. During recent testing, we found thatQ67
inTPC-DS
still runs out of memory under tight memory conditions. This is becauseQ67
is a special case where all input data is in one window partition. Therefore, we plan to support the Spill case within theStreamingWindow
.Here are the steps we take to implement Spill in StreamingWindow:
addInput()
phase. After all data in a completeWindowPartition
has been added, the remaining data are spilled to a file. Then, when callingnextPartition()
, if the currentWindowPartition
has been spilled to a file, it is read from the file; otherwise, it is read from memory.WindowFunction
currently supports readingWindowPartition
from memory. Therefore, we also need to support reading data from the spill file inWindowPartition
later.Regarding the first step, we have currently proposed a Draft PR to implement spill support during
addInput()
phase. Can you help to review whether this method is feasible? Thanks. @mbasmanova @aditi-pandit @zhouyuan @zhztheplayerBeta Was this translation helpful? Give feedback.
All reactions