Skip to content

tet query

Run a JSON or TOML query against a .tet file — plan only, or plan + execute.

See the Query engine overview for what operations are supported, memory strategies, and limitations.

Usage

bash
tet query [OPTIONS] [QUERY]

Alias: tet q

QUERY: path to .json / .toml, inline JSON/TOML, - for stdin, or omit to read stdin.

Format detection: file extension .json / .toml, else leading { → JSON, otherwise TOML.

Key flags

FlagEffect
-t, --tet PATHAttach catalog / read plan (required for -x)
-x, --executeDecode tiles, run operation, attach execution
--formatfull (default), json, stats, plan, quiet, table
-q, --quietShorthand for --format quiet
--preview NCap preview sample values when executing (default 64 for full/json, 0 for stats/plan/quiet/table)
--device DEVICETier-A/B device routing (cpu, auto, metal, cuda, cuda:N, rocm, rocm:N, cuda:multi, rocm:multi)
--spill-allow DIRExtra spill roots (repeatable; needs -x and -t)

Output formats

--formatstdout
full (default)Pretty JSON, full QueryResponse
jsonCompact one-line JSON
statsSlim JSON: status, aggregates — no chunk list or preview arrays
planSlim JSON: catalog + read_plan summary only
quiet / -qOne line: dataset=… status=… op=… + primary aggregate
tableASCII tables: summary, plan, aggregates, optional preview

Errors go to stderr with non-zero exit. See Exit codes & errors.

Query document shape

Queries are flat JSON or TOML. Nested "operation" objects are rejected.

json
{ "dataset": "temperature", "mean": [] }
toml
dataset = "temperature"
mean = []

Full wire format: Query document.

Examples

bash
# TOML file — plan + execute with quiet output
tet query mean.toml -t data.tet -x -q

# JSON file
tet query mean.json -t data.tet -x -q

# Inline JSON
tet query '{"dataset":"temperature","mean":[]}' -t data.tet -x -q

# Inline TOML
tet query 'dataset = "temperature"
mean = []' -t data.tet -x -q

# Plan only (no decode)
tet query mean.toml -t data.tet --format plan

# Table output with preview
tet query slice.toml -t data.tet -x --format table --preview 6

# Stats JSON (no chunk list)
tet query mean.toml -t data.tet -x --format stats

Transform with sidecar write:

json
{
  "dataset": "temperature",
  "transform": { "method": "zscore" },
  "write": { "target": "sidecar", "timestamp": false }
}
toml
dataset = "temperature"

[transform]
method = "zscore"

[write]
target = "sidecar"
timestamp = false
bash
tet query zscore.toml -t data.tet -x -q

Export selection to binary:

json
{ "dataset": "temperature", "spill": "slice.bin" }
toml
dataset = "temperature"
spill = "slice.bin"
bash
tet query spill.toml -t data.tet -x --format stats

More patterns: Query cookbook.

Supported operations

Tier-A/B — streaming (fast on large data)

Scalar and partial-axis: sum, mean, min, max, count, var, std, product, norm_l1, norm_l2, nan_mean, nan_std, arg_min, arg_max, all_finite, any_nan, any_inf, nan_count, inf_count, null_count.

Use [] for scalar over the selection; 0, [0, 1], or "time" / mean = "time" for partial axes.

Tier-C — materialize-required

median, quantile, histogram, covariance, correlation — may use temp spill when selection exceeds RAM budget.

Transforms (f32 / f64 only)

zscore, minmax, l1, l2, center, scale, log1p, sqrt, softmax.

Export

Top-level "spill": "path" exports the full logical selection without a reduction key.

Full reference: Operations.

Transform write targets

With -x and -t:

TargetBehavior
ramDense buffer in memory
switchRoute based on size (default)
spillWrite to spill path
sidecarPublish a one-chunk .tet beside the source

Sidecar default filename: {stem}.{method}.{timestamp}.tet. Set "timestamp": false for a stable name.

Details: Execution strategies.

GPU (experimental)

Use --device auto or set execution.device in the query document. Requires building with tetration-metal (macOS) or tetration-gpu (NVIDIA). CPU streaming fold remains the default for large selections.

Tier-A/B dense f32/f16 only. var/std stay on host SIMD. See Execution strategies — GPU.

Query history

Recent queries are stored in platform cache (not in the .tet file):

bash
tet qhist list
tet qhist run 1

See tet qhist.

Latka Industries