id: tabular_select
name: Select
description: >
  Select, rename, or compute columns from a table. Can pick a subset
  of columns, exclude columns, or add computed expressions.
version: 1.0.0
category: transform
type: table-to-table
default_implementation: duckdb

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

requires: {}  # structural — operates on any table

outputs:
  - name: result
    type: table
    format: parquet
    description: Table with selected columns

params:
  columns:
    type: array
    description: >
      Column names to include. If omitted, all columns are included
      (subject to exclude list).
  exclude:
    type: array
    description: Column names to exclude (applied after columns selection)
  expressions:
    type: object
    description: >
      Computed columns as alias -> SQL expression.
      Example: {"full_name": "first_name || ' ' || last_name", "age_bucket": "age / 10 * 10"}

# 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_select
    dispatch: packages/compute/src/ops/tabular-sql.ts
  python:
    function: tabular.ops.select
    dispatch: folia/compute.py _BUILTIN_OP_MAP

display_hints:
  table:
    renderer: tanstack-table
