Documentation
¶
Overview ¶
Package shareparams is the one reading of WIN_SHARE's and WIN_LIFT's slot, shared by the window factory (internal/processing/window) and predict (internal/descriptor) so both refuse the same request with the same code and the same rule sentence. It decides what a request MEANS and never divides a value.
The rules, in the order they are judged:
- params decode (WIN_SHARE: cumulative; WIN_LIFT: cumulative, base);
- field is required (the column whose share is taken);
- WIN_LIFT: params.base is required (the column it is compared with);
- frame is refused: a share is always of the whole partition's total, and the cumulative running sum always runs from the partition's first row to the current one;
- cumulative true needs order_by (the running sum needs an order); cumulative false (the default) needs none.
Every refusal is PULSE_WINDOW_INVALID on both sides: predict prefixes "window[i] (TYPE): ", the factory "TYPE: ".
Leaf: stdlib + the public errors / types packages + paramread.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handles ¶
func Handles(t types.WindowType) bool
Handles reports whether t is one of the two operators this package reads.
Types ¶
type Refusal ¶
type Refusal struct {
Op types.WindowType
Message string
Details map[string]any
}
Refusal is one violated rule: Message is the operator-neutral sentence (callers prefix their own context) and Details the offending values.
func (*Refusal) Coded ¶
func (r *Refusal) Coded() *errors.CodedError
Coded returns the refusal as the factory raises it: PULSE_WINDOW_INVALID, prefixed with the operator name.
type Spec ¶
type Spec struct {
// Cumulative selects the running share (unbounded preceding to the
// current row, over the partition's total) instead of the row's own.
Cumulative bool
// Base is WIN_LIFT's comparison column; "" on WIN_SHARE.
Base string
}
Spec is the resolved meaning of one WIN_SHARE / WIN_LIFT slot.