Deterministic operators
← Relifold documentation

Filter

Keep rows selected by a deterministic predicate.

Filter retains rows for which a trusted callable returns true.

Worked example

Filter(
    name="recent-us-headlines",
    input_spaces=("parsed-headlines",),
    output_space="recent-us-headlines",
    primary_key="news_id",
    evidence=("market", "published_at"),
    fn=lambda row: (
        row["market"] == "US"
        and row["published_at"] >= cutoff
    ),
)

Callable contract

fn(row) -> bool.

Rows available to the callable

Each row argument contains the declared primary-key fields and the declared evidence fields available for that input role. If the callable reads a field that is not part of the primary key, declare it as evidence.

ParameterDefaultMeaning
input_spacesrequiredThe Space or Spaces read by the task.
output_spacerequiredThe Space that receives the task output.
namerequiredA stable task name used in sessions, reviews, and metrics.
primary_keyidThe field, or tuple of fields, that identifies one task input. Duplicate primary-key values are evaluated once.
evidencenoneOptional fields made available to the callable in addition to the primary key.
fnrequiredA deterministic callable that completely defines the operation's decision. Use an importable named function from your package, or PythonFunction(name=..., source=...) when authoring through the hosted API or node editor. Pairwise endomorphic functions may declare an exact indexed candidate_gate.
function_parametersregistered defaultsTyped values bound to parameters declared by the registered function. Finite candidate sets let reviewed evidence support parameter advice.

Output

A subset of the input rows. Retained rows keep their existing fields.

Design guidance

Use Filter for dates, numeric bounds, missing values, exact membership, and schema checks. Use SemFilter only when the criterion requires interpreting language.