id: tabular_filter
name: Filter
description: >
  Filter table rows using a SQL WHERE expression. Returns only rows
  that match the condition.
version: 1.0.0
category: transform
type: table-to-table
default_implementation: duckdb

inputs:
  - name: table
    type: table
    format: parquet
    description: Input table to filter
    required: true

requires: {}  # structural — operates on any table

outputs:
  - name: result
    type: table
    format: parquet
    description: Filtered table

params:
  where:
    type: string
    description: >
      SQL WHERE expression (e.g., "age > 21 AND status = 'active'").
      Column names reference the input table.
    required: true

# backends: audited 2026-08-14 (defect 50). A key means a runtime that DISPATCHES this op —
# folia-engine `dispatch_op` (products/sdk/folia-engine/src/lib.rs), a `registerOp`/OP_TABLE
# entry in packages/compute, `_BUILTIN_OP_MAP` in folia/compute.py, or a backend manifest
# (folia/backends/*/backend.yaml).
backends:
  js:
    function: tabular_filter
    dispatch: packages/compute/src/ops/tabular-filter.ts
  python:
    function: tabular.ops.filter
    dispatch: folia/compute.py _BUILTIN_OP_MAP

display_hints:
  table:
    renderer: tanstack-table
