Data & Resources
Data types
Section titled “Data types”Relational types
Int: 64-bit signed integer.Float(aliasFLOAT32): 32-bit float. Standard precision for tensor values;Vector/Matrix/Tensorelements are always this precision.Double(aliasFLOAT64): 64-bit float. Use this for large-magnitude scalars (GPS/Unix timestamps, etc.) that exceedFloat’s ~7 significant digits: a plainFloatcolumn silently rounds these. Arithmetic mixing aDoublewithFloat/Intalways promotes toDouble. Not available forVector/Matrix/Tensorelements, which stayFloat-only.String: UTF-8 text.Bool:true/false.Complex: a scalar complex number (real + imaginary part). Construct withCOMPLEX(re, im); decompose withREAL/IMAG/ABS/PHASE/CONJ(see Querying). Arithmetic mixingComplexwith any numeric type always promotes toComplex: it’s the widest scalar type. Has equality (=/!=/INall work) but no ordering:MIN/MAX/ORDER BYon aComplexcolumn error loudly rather than guess;SUM/AVGwork normally, since those are mathematically well-defined for complex numbers. Scalar only, not available forVector/Matrix/Tensorelements.Null: a missing value. Mark a column nullable with a?suffix:score: Float?.
Tensor types
Vector(N): a 1D tensor withNelements.Matrix(R, C): a 2D tensor withRrows,Ccolumns.Tensor(d1, d2, ...): an N-dimensional tensor.
Defining tensors
Section titled “Defining tensors”Quick shorthand:
VECTOR v = [1.0, 2.0, 3.0]MATRIX m = [[1, 2], [3, 4]]Explicit form for higher dimensions:
DEFINE t AS TENSOR [2, 2, 2] VALUES [1, 2, 3, 4, 5, 6, 7, 8]
-- STRICT propagates its shape-strictness through any op it's involved in,-- preventing accidental shape relaxationDEFINE w AS STRICT TENSOR [3] VALUES [1, 0, 0]Defining datasets
Section titled “Defining datasets”DATASET diagnostics COLUMNS ( id: Int, region: String, score: Float?, -- nullable column features: Vector(128) -- embedded tensor)A second form materializes a dataset from a query against an existing one, like
SELECT ... FROM <source> ... but persisted under a new name instead of returned inline:
DATASET seniors FROM employees FILTER age >= 60
DATASET top_scores FROM diagnostics FILTER region = "west" SELECT region, AVG(score) GROUP BY region HAVING AVG(score) > 0.5 ORDER BY region LIMIT 10DATASET <name> FROM <source> [FILTER|WHERE <expr>] [SELECT <cols>] [GROUP BY <cols>] [HAVING <expr>] [ORDER BY <cols>] [LIMIT <n>] [OFFSET <n>]: every clause after FROM <source> is optional and behaves like its SELECT equivalent.
Tensor-first datasets
Section titled “Tensor-first datasets”For a zero-copy, tensor-centric alternative to DATASET COLUMNS (...), construct an
empty named dataset and attach existing tensors as columns:
LET ds = dataset("my_dataset") -- registers an empty dataset, O(1)
VECTOR v_temp = [36.6, 37.1, 36.9]LET raw = dataset("raw")raw.add_column(temp, v_temp) -- <dataset_var>.add_column(<name>, <tensor_var>)add_column is a metadata-only operation: no data is copied.
Zero-copy aliases and derived resources
Section titled “Zero-copy aliases and derived resources”BIND alias TO resource: create a semantic alias to a tensor or dataset.ATTACH tensor TO ds.col: link an independent tensor into a dataset column.DERIVE target FROM expr: create a new resource with full automatic lineage tracking.exprmust be a real computed expression;DERIVE b FROM a(a bare identifier) is a clear error pointing atBIND/LETinstead, since aliasing creates no new lineage node.LET name = <bare identifier>is also a zero-copy alias, equivalent toBIND name TO <bare identifier>; works for a plain tensor name or adataset()-constructed tensor-first dataset variable.LAZY LET name = <bare identifier>is a clear error (nothing to defer in a plain alias).
Schema evolution
Section titled “Schema evolution”ALTER DATASET ds ADD COLUMN col: type [DEFAULT val]ALTER DATASET ds ADD COLUMN col = expression [LAZY]MATERIALIZE ds: physicalize allLAZYcolumns in a dataset.SET DATASET ds [METADATA] key = "value": attach a string metadata key (theMETADATAkeyword is optional). Retrieve it withSHOW DATASET METADATA <name>(see Persistence & Server).

