Window Functions

From MemCP
Revision as of 08:38, 27 August 2026 by Carli (talk | contribs) (Created page with "← Back to Full SCM API documentation == stream_emit == invokes a streaming callback immediately; marks ordering-sensitive emission as an observable effect '''Allowed number of parameters:''' 2–2 <span id="parameters"></span> === Parameters === * '''emit''' (<code>func(value:any) -> any</code>): * '''value''' (<code>any</code>): <span id="returns"></span> === Returns === <code>any</code> == stream_window_reduce == applies OFFSET/LIMIT and a serial redu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

← Back to Full SCM API documentation

stream_emit

invokes a streaming callback immediately; marks ordering-sensitive emission as an observable effect

Allowed number of parameters: 2–2

Parameters

  • emit (func(value:any) -> any):
  • value (any):

Returns

any

stream_window_reduce

applies OFFSET/LIMIT and a serial reducer to complete values emitted by a nested streaming producer without collecting an intermediate relation

Allowed number of parameters: 5–5

Parameters

  • offset (number): number of complete producer values to skip
  • limit (number): maximum values to reduce, or -1 for no limit
  • reduce (func(acc:any, value:any) -> any): serial accumulator over complete values
  • neutral (any): initial accumulator
  • producer (func(emit:func) -> any): nested streaming plan called with a one-value emit callback

Returns

any

window_mut

Ring buffer shift-insert for window functions. (window_mut window emit_fn vals) writes vals (a list of stride values) into the current slot, increments counter. If skip>0, decrements skip. Otherwise calls (emit_fn oldest_v0 oldest_v1 ... newest_v0 newest_v1) with all slot values ordered oldest-to-newest. Returns updated window.

Allowed number of parameters: 3–3

Parameters

  • window (list): ring buffer accumulator
  • emit_fn (func(values:any...) -> any): callback receiving all window values oldest-to-newest
  • vals (list): list of stride values to insert

Returns

list

window_flush

Flush remaining window buffer by shifting in nils. (window_flush window emit_fn count) shifts in count positions of nils, calling emit_fn for each displaced position. Returns nil.

Allowed number of parameters: 3–3

Parameters

  • window (list): ring buffer accumulator
  • emit_fn (func(values:any...) -> any): callback receiving all window values oldest-to-newest
  • count (number): number of nil positions to shift in

Returns

nil

show_processlist

returns a list of active sessions for SHOW [FULL] PROCESSLIST; pass true for full info

Allowed number of parameters: 0–1

Parameters

  • full (bool): if true, include full Info text (optional)

Returns

list

connection_id

returns the process-list ID of the current session (MySQL CONNECTION_ID() equivalent)

Allowed number of parameters: 0–0

Parameters

This function has no parameters.

Returns

int

kill_query

cancel the running query in session id; returns true if a query was killed

Allowed number of parameters: 1–1

Parameters

  • id (int): session ID from SHOW PROCESSLIST

Returns

bool