FrameSize returns the number of rows in the current frame (taking into account - if present - a filter and a frame exclusion).
(ctx context.Context, evalCtx *EvalContext)
| 442 | // FrameSize returns the number of rows in the current frame (taking into |
| 443 | // account - if present - a filter and a frame exclusion). |
| 444 | func (wfr *WindowFrameRun) FrameSize(ctx context.Context, evalCtx *EvalContext) (int, error) { |
| 445 | if wfr.Frame == nil { |
| 446 | return wfr.DefaultFrameSize(), nil |
| 447 | } |
| 448 | frameEndIdx, err := wfr.FrameEndIdx(ctx, evalCtx) |
| 449 | if err != nil { |
| 450 | return 0, err |
| 451 | } |
| 452 | frameStartIdx, err := wfr.FrameStartIdx(ctx, evalCtx) |
| 453 | if err != nil { |
| 454 | return 0, err |
| 455 | } |
| 456 | size := frameEndIdx - frameStartIdx |
| 457 | if !wfr.noFilter() || !wfr.Frame.DefaultFrameExclusion() { |
| 458 | size = 0 |
| 459 | for idx := frameStartIdx; idx < frameEndIdx; idx++ { |
| 460 | if skipped, err := wfr.IsRowSkipped(ctx, idx); err != nil { |
| 461 | return 0, err |
| 462 | } else if skipped { |
| 463 | continue |
| 464 | } |
| 465 | size++ |
| 466 | } |
| 467 | } |
| 468 | if size <= 0 { |
| 469 | size = 0 |
| 470 | } |
| 471 | return size, nil |
| 472 | } |
| 473 | |
| 474 | // Rank returns the rank of the current row. |
| 475 | func (wfr *WindowFrameRun) Rank() int { |
nothing calls this directly
no test coverage detected