Skip to main content
DB

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.

FunctionSummary
generate_randomCreates a finite seeded relation from a constant typed column schema.
series_generateEmits a finite inclusive sequence using an integer or calendar-aware step.
series_numbersGenerates a counted unsigned progression with optional starting value and stride.
series_zerosProduces 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,...))
Kindtable
Signature classtable/ternary+generic
Returnstable(tuple(T1,T2,...))
StreamingOne-shot only.
DeterminismDeterministic — the same arguments always give the same result.
NULL handlingAny 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))
-- → 3

series_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)))
Kindtable
Signature classtable/3..4-ary+defaults+timezone
Returnstable(tuple(value:int64)) or table(tuple(value:datetime64(p,tz)))
Aliasesgenerate_series
StreamingOne-shot only.
DeterminismDeterministic — the same arguments always give the same result.
NULL handlingNULL 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))
-- → 6

series_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))
Kindtable
Signature classtable/1..3-ary
Returnstable(tuple(number:uint64))
Aliasesnumbers
StreamingOne-shot only.
DeterminismDeterministic — the same arguments always give the same result.
NULL handlingAny 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))
-- → 3

series_zeros

Produces a finite one-column relation containing a requested number of zero values.

series_zeros(count:uint64) -> table(tuple(zero:uint8))
Kindtable
Signature classtable/unary
Returnstable(tuple(zero:uint8))
Aliaseszeros
StreamingOne-shot only.
DeterminismDeterministic — the same arguments always give the same result.
NULL handlingAny 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

On this page