Implement RANGE bounded window frame#561
Conversation
There was a problem hiding this comment.
the last argument must be endPosition - (peerGroupEnd - 1) here, I will fix that in the next patch where we will have bounded following.
There was a problem hiding this comment.
Add assertion for frameEnd till you implement following.
0e78f1c to
671c16d
Compare
There was a problem hiding this comment.
Add assertion for frameEnd till you implement following.
There was a problem hiding this comment.
This test is virtually a duplicate of 0e78f1c#diff-f122e8a4be46fc9376777791451e4d94R599
| private boolean emptyFrame(FrameInfo frameInfo, int rowPosition, int endPosition) | ||
| private int precedingEndRange(long endValue) | ||
| { | ||
| int peerGroupEndIndex = peerGroupEndIndices.indexOf(peerGroupEnd); |
There was a problem hiding this comment.
I'd use Map<Integer, Integer> (peer group -> position) instead of ArrayList<Integer>, to avoid slowness when there are many tiny groups in a large partition.
Imagine billions of rows with ~1 row / peer group.
Then indexOf will be O(billions). But if you use a Map, it's gonna be O(log(billions)).
| while (currentValue < value) { | ||
| boolean peerFound = false; | ||
| followingPeerGroupEnd = followingPeerGroupStart + 1; | ||
| while ((followingPeerGroupEnd < partitionEnd) && pagesIndex.positionEqualsPosition(peerGroupHashStrategy, followingPeerGroupStart, followingPeerGroupEnd)) { |
There was a problem hiding this comment.
What if there are no peers, just each row is a distinct value within the partition?
You'd never set peerFound = true, IIUC so this loop would never end?
Can you explain this to me?
No description provided.