name: op-filter-expression
description: Keep records for which an expr-lang expression evaluates truthy against record fields.
kind: operator
category: FILTER
operator: FILTER_EXPRESSION
type: reference
applies_to: process, compose, predict
examples_tags: [cohort-analysis, feature-engineering, streaming-friendly]
Use when
Keeps the rows for which a written yes-or-no condition is true, for rules the other filters cannot state, such as two fields together.
Questions it answers:
- Which customers spent over 500 and joined this year?
- Which records have an end date before their start date?
Use something else:
FILTER_INCLUDEwhen you only need to keep a list of values.FILTER_RANGEwhen you only need a low and a high limit.
Params
| Name | Type | Default | Description |
|---|---|---|---|
expression | string | (required) | Top-level slot key, not params: expr-lang bool predicate. |
Inputs
field— unused — the expression names fields.
Categorical → STRING; set_* → a sorted label list (has_any(tags, "a")); decimal128 → an exact decimal (price * 1.1 > cost, decimal-formulas); date → epoch days, datetime → epoch seconds — day helpers need to_day (calendar-formulas).
Output
Row-level predicate. No emitted column.
Contract
- Types: any type.
- Weight: not read; a weight in force is skipped.
- Streaming: streamable; components
mergeable. - Components:
n_in,n_out,n_null_input.
Gotchas
- Compiled once; bad syntax / names / types →
PULSE_FORMULA_COMPILE_ERRORat predict and build (reason:details.compile_error). - Null binds
nil:==false,!=true,x ?? 0fills;>/+/lenon nil → predicate UNKNOWN, row dropped. - A non-bool typed result (
x + 1) →PULSE_FORMULA_COMPILE_ERROR(predict, build); an untyped non-bool result on a non-null row, or an eval error →PROCESSING_RUNTIME. %on a field: floatmath.Mod(age % 2 == 0);% 0→ NaN,/ 0→ ±Inf.- Reads source fields, feature labels and previous-state labels (
ATTR_PREVIOUS_STATE), which run before filters; a later label is unknown (the message names its window, attribute or aggregation). - Pass values as
params:panel == params.from_wavewith"params": {"from_wave": "a"}, never spliced text (request-params). coef()of a compose fit that failed on its data (compose-fits) refuses the request at build with the fit’s own code +details.fit: a filter verdict cannot be null.
See
pulse_examples_search tags=[feature-engineering]- Skills:
expression-language(maths, trig and vector functions,ExprFunctions,LookupTables),aggregation-design,response-components