isRowExcluded returns whether the row at index idx should be excluded from the window frame of the current row.
(idx int)
| 597 | // isRowExcluded returns whether the row at index idx should be excluded from |
| 598 | // the window frame of the current row. |
| 599 | func (wfr *WindowFrameRun) isRowExcluded(idx int) (bool, error) { |
| 600 | if wfr.Frame.DefaultFrameExclusion() { |
| 601 | // By default, no rows are excluded. |
| 602 | return false, nil |
| 603 | } |
| 604 | switch wfr.Frame.Exclusion { |
| 605 | case ExcludeCurrentRow: |
| 606 | return idx == wfr.RowIdx, nil |
| 607 | case ExcludeGroup: |
| 608 | curRowFirstPeerIdx := wfr.PeerHelper.GetFirstPeerIdx(wfr.CurRowPeerGroupNum) |
| 609 | curRowPeerGroupRowCount := wfr.PeerHelper.GetRowCount(wfr.CurRowPeerGroupNum) |
| 610 | return curRowFirstPeerIdx <= idx && idx < curRowFirstPeerIdx+curRowPeerGroupRowCount, nil |
| 611 | case ExcludeTies: |
| 612 | curRowFirstPeerIdx := wfr.PeerHelper.GetFirstPeerIdx(wfr.CurRowPeerGroupNum) |
| 613 | curRowPeerGroupRowCount := wfr.PeerHelper.GetRowCount(wfr.CurRowPeerGroupNum) |
| 614 | return curRowFirstPeerIdx <= idx && idx < curRowFirstPeerIdx+curRowPeerGroupRowCount && idx != wfr.RowIdx, nil |
| 615 | default: |
| 616 | return false, errors.AssertionFailedf("unexpected WindowFrameExclusion") |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | // IsRowSkipped returns whether a row at index idx is skipped from the window |
| 621 | // frame (it can either be filtered out according to the filter clause or |
no test coverage detected