Functions
Table functions
4 Table functions in NYXDB: names, aliases, signatures and behaviour.
4 functions. Names resolve case-insensitively; an alias binds the same function as its canonical name. Each entry gives the signatures, the behaviour and an example.
| Function | Summary |
|---|---|
generate_random | Creates a finite seeded relation from a constant typed column schema. |
series_generate | Emits a finite inclusive sequence using an integer or calendar-aware step. |
series_numbers | Generates a counted unsigned progression with optional starting value and stride. |
series_zeros | Produces a finite one-column relation containing a requested number of zero values. |
generate_random
Creates a finite seeded relation from a constant typed column schema.
generate_random(schema:string,count:uint64,seed:uint64) -> table(tuple(T1,T2,...))| Kind | table |
| Signature class | table/ternary+generic |
| Returns | table(tuple(T1,T2,...)) |
| Streaming | One-shot only. |
| Determinism | Deterministic — the same arguments always give the same result. |
| NULL handling | Any NULL argument gives NULL. |
Binds the schema string to column descriptors and generates exactly the requested row count with seed-fixed values and order. A NULL argument propagates through the table call; invalid schemas raise TYPE_MISMATCH and excessive output raises RESOURCE_LIMIT. It is a one-shot synthetic relation and does not establish a persistent stream source.
Example
(SELECT count(*) FROM generate_random('reading int64', 3, 7))
-- → 3series_generate
Emits a finite inclusive sequence using an integer or calendar-aware step.
series_generate(start:int64,stop:int64,step:int64=1) -> table(tuple(value:int64))
series_generate(start:datetime64(p,tz),stop:datetime64(p,tz),step:tuple(int64,string),timezone:string) -> table(tuple(value:datetime64(p,tz)))| Kind | table |
| Signature class | table/3..4-ary+defaults+timezone |
| Returns | table(tuple(value:int64)) or table(tuple(value:datetime64(p,tz))) |
| Aliases | generate_series |
| Streaming | One-shot only. |
| Determinism | Deterministic — the same arguments always give the same result. |
| NULL handling | NULL arguments produce zero rows; zero step errors |
Includes the stop value when reached exactly and supports negative steps; NULL arguments produce no rows. A zero step raises INVALID_ARGUMENT, while row-budget exhaustion raises RESOURCE_LIMIT before materialization. Temporal overloads use explicit count/unit tuples and a timezone for calendar arithmetic, and every overload is restricted to one-shot relation generation.
Example
(SELECT sum(value) FROM series_generate(1, 3))
-- → 6series_numbers
Generates a counted unsigned progression with optional starting value and stride.
series_numbers(count:uint64) -> table(tuple(number:uint64))
series_numbers(start:uint64,count:uint64) -> table(tuple(number:uint64))
series_numbers(start:uint64,count:uint64,step:uint64) -> table(tuple(number:uint64))| Kind | table |
| Signature class | table/1..3-ary |
| Returns | table(tuple(number:uint64)) |
| Aliases | numbers |
| Streaming | One-shot only. |
| Determinism | Deterministic — the same arguments always give the same result. |
| NULL handling | Any NULL argument gives NULL. |
The count specifies how many uint64 rows to emit, beginning at zero with step one unless supplied otherwise. A NULL argument propagates through the call, zero step raises INVALID_ARGUMENT and arithmetic overflow raises NUMERIC_OVERFLOW. The finite one-shot relation is subject to RESOURCE_LIMIT admission and does not become an ongoing stream.
Example
(SELECT sum(number) FROM series_numbers(3))
-- → 3series_zeros
Produces a finite one-column relation containing a requested number of zero values.
series_zeros(count:uint64) -> table(tuple(zero:uint8))| Kind | table |
| Signature class | table/unary |
| Returns | table(tuple(zero:uint8)) |
| Aliases | zeros |
| Streaming | One-shot only. |
| Determinism | Deterministic — the same arguments always give the same result. |
| NULL handling | Any NULL argument gives NULL. |
Emits count rows whose zero column has type uint8, with count zero producing an empty relation. NULL count propagates through the table call and a row request beyond the admitted limit raises RESOURCE_LIMIT. This bounded synthetic source is one-shot only and maintains no persistent streaming state.
Example
(SELECT sum(zero) FROM series_zeros(3))
-- → 0