Reference

SPQL

Look up every SPQL function and data type, with signatures that hold wherever you call them.

SPQL is Spiral's library of functions and data types for working with Table data, from string and date functions such as spql.str.upper and spql.dt.year to image decoding and tensor math. A function name means the same thing everywhere you can call it: inside a Scan next to storage, on Arrow batches your application holds, or in a DataFusion query. So a value computed in one place matches the value computed in the others, and you can move work between them without changing results.

This reference lists every function with its signatures. Each function is a scalar function: it computes one value from the values in one row. Enrichment expressions use the same functions. To see exactly which functions and argument types your native library provides, call Functions::list.

Read a signature

One function name can accept several combinations of argument types. Each combination is an overload, with its own parameter types, output type, and nullability. When you call a function, Spiral picks the overload that matches your argument types before any rows are read. If none matches, the call fails right away. SPQL never casts arguments implicitly, so add an explicit cast when your types differ.

Some parameters must be literal values, such as a format name or a unit. A signature shows a literal parameter as a placeholder value, such as 'method' or 1, instead of a name. An optional parameter has a ? suffix.

The type after -> is the result. A ? on a type means it can be null. type(value) preserves that argument's type and nullability. An inferred result depends on the argument types; a declared result is supplied by the caller. Notes below each signature explain conditional nullability and any refinement by literal arguments.

Namespaces

A function's name starts with a namespace that groups related functions, for example:

NamespaceArea
spql.strStrings.
spql.dtDates, times, durations, and periods.
spql.ioBlobs, URIs, archives, and byte input and output.
spql.imageImage types, metadata, and decoding.
spql.tensorTensor and vector operations.

Data types

Signatures use the type names on the data types page. Semantic types, such as vector(n) or an image, give a meaning to a storage layout. Each semantic type has its own type ID, so a function that expects a vector rejects an arbitrary fixed-size list with the same layout.

Call a function

  • In a Scan, build the call with Expression::call. See Reading.
  • On your own Arrow batches, evaluate the calls with Functions. See Functions.
  • In SQL, register the functions with with_spql and quote the dotted name, as in "spql.str.upper"(camera). See DataFusion.

The expressions page explains where each expression runs.

Functions by domain

Each page documents one domain. For each function, it gives the signatures, the parameter types, and the result. The data types page defines the type names that the signatures use.

DomainFunctionsSummary
Expressions & Operators21Compare values and combine arithmetic and logical expressions.
Strings21Transform, measure, and match text values.
Binary & Hashing13Encode, inspect, and hash byte values.
Math24Apply numeric rounding, logarithmic, root, and trigonometric functions.
Lists5Measure, search, and reduce list values.
Date & Time48Construct, extract, and transform dates, times, timestamps, durations, and periods.
Blobs & I/O15Work with URI-backed byte payloads, blob metadata, and archive ingestion.
Images12Decode and encode display-oriented images, inspect properties, and read JPEG metadata.
Depth Maps8Inspect depth samples, representation, confidence, and calibration metadata.
Object Detection3Inspect detected object labels, bounding boxes, and confidence scores.
Video16Inspect encoded media and MP4 structure, select video frames, and decode images.
Tensors & Vectors7Tensor and vector math, including similarity measures and norms.
Model Inference (planned)8Run admitted, revision-pinned models over typed multimodal values.
Robotics35Ingest robotics logs such as MCAP, and construct poses, transforms, point clouds, scenes, annotations, and sensor values.
Geospatial13Measure distances and evaluate spatial predicates over geometries (points, polygons, and multipolygons).
Visualization45Construct typed views, charts, spatial primitives, and layouts.
Found a problem? Edit this page or report an issue.

On this page