MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / isRowExcluded

Method isRowExcluded

pkg/sql/sem/tree/window_funcs.go:599–618  ·  view source on GitHub ↗

isRowExcluded returns whether the row at index idx should be excluded from the window frame of the current row.

(idx int)

Source from the content-addressed store, hash-verified

597// isRowExcluded returns whether the row at index idx should be excluded from
598// the window frame of the current row.
599func (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

Callers 1

IsRowSkippedMethod · 0.95

Calls 3

DefaultFrameExclusionMethod · 0.80
GetFirstPeerIdxMethod · 0.80
GetRowCountMethod · 0.80

Tested by

no test coverage detected