Frame end points are always expected to go from frameStart to frameEnd rows in increasing row numbers in the partition. k rows/range frames could potentially violate this. This function identifies the rows that violate the framing requirements and sets bits in the validFrames SelectivityVector for usage in the WindowFunction subsequently.
| 714 | // and sets bits in the validFrames SelectivityVector for usage in the |
| 715 | // WindowFunction subsequently. |
| 716 | void computeValidFrames( |
| 717 | vector_size_t lastRow, |
| 718 | vector_size_t numRows, |
| 719 | vector_size_t* rawFrameStarts, |
| 720 | vector_size_t* rawFrameEnds, |
| 721 | SelectivityVector& validFrames) { |
| 722 | auto frameStart = 0; |
| 723 | auto frameEnd = 0; |
| 724 | |
| 725 | for (auto i = 0; i < numRows; i++) { |
| 726 | frameStart = rawFrameStarts[i]; |
| 727 | frameEnd = rawFrameEnds[i]; |
| 728 | // All valid frames require frameStart <= frameEnd to define the frame |
| 729 | // rows. Also, frameEnd >= 0, so that the frameEnd doesn't fall before the |
| 730 | // partition. And frameStart <= lastRow so that the frameStart doesn't |
| 731 | // fall after the partition rows. |
| 732 | if (frameStart <= frameEnd && frameEnd >= 0 && frameStart <= lastRow) { |
| 733 | rawFrameStarts[i] = std::max(frameStart, 0); |
| 734 | rawFrameEnds[i] = std::min(frameEnd, lastRow); |
| 735 | } else { |
| 736 | validFrames.setValid(i, false); |
| 737 | } |
| 738 | } |
| 739 | validFrames.updateBounds(); |
| 740 | } |
| 741 | |
| 742 | }; // namespace |
| 743 |
no test coverage detected