Clinker Expression Language Overview
Clinker Expression Language (CXL) is a per-record ETL expression language. Every program operates on one record at a time, producing output fields, filtering records, or computing derived values.
Programs are sequences of emit, let, filter, and distinct statements
that execute from top to bottom against the current record.
Core expression forms
| Intent | CXL form |
|---|---|
| Produce or rename a field | emit alias = col |
| Keep only matching records | filter condition |
| Combine conditions | and / or / not (keywords) |
| Choose the first non-null value | a ?? b |
| Choose between values | if ... then ... else ... or match { } |
Boolean operators are keywords
CXL uses English keywords for boolean logic, not symbols:
$ cxl eval -e 'emit result = true and false' --field dummy=1
{
"result": false
}
The operators &&, ||, and ! are syntax errors in CXL. Always use and, or, and not.
System namespaces use $ prefix
CXL provides built-in namespaces for accessing pipeline state, metadata, and window functions. All system namespaces are prefixed with $:
$pipeline.*– pipeline execution context (name, counters, provenance) and pipeline-scope declared state$source.*– per-source context and source-scope declared state$record.*– per-record scoped state (travels with the record, never an output column)$window.*– window function calls$vars.*– static, channel-overridable configuration$config.*– a composition’s config parameters, read inside its body (constant-folded per instantiation)
$ cxl eval -e 'emit name = $pipeline.name'
{
"name": "cxl-eval"
}
Compile-time type checking
CXL is statically type-checked, so type errors are caught before any data is processed. Run cxl check to validate a transform before a run. Errors come with source locations and fix suggestions.
$ cxl check transform.cxl
ok: transform.cxl is valid
If there are type errors, the checker reports them with spans:
error[typecheck]: cannot apply '+' to String and Int (at transform.cxl:12)
help: convert one operand — use .to_int() or .to_string()
A minimal CXL program
emit greeting = "hello"
emit doubled = amount * 2
filter amount > 0
This program:
- Emits a constant string field
greeting - Emits
doubledas twice the inputamount - Filters out records where
amountis not positive
Try it:
$ cxl eval -e 'emit greeting = "hello"' -e 'emit doubled = amount * 2' \
--field amount=5
{
"greeting": "hello",
"doubled": 10
}
Statement order matters
CXL statements execute sequentially. Later statements can reference fields produced by earlier emit or let statements:
$ cxl eval -e 'let tax_rate = 0.21' -e 'emit tax = price * tax_rate' \
--field price=100
{
"tax": 21.0
}
A filter statement short-circuits execution – if the condition is false, remaining statements do not run and the record is excluded from output.