feat: transformers as UDAFs v0 — just run the pipeline - #61
Merged
Conversation
Window calls with names unknown to DuckDB resolve to transformer
objects: explicit registry first, then the caller's Python scope (the
FROM-df replacement-scan idiom), guarded by the oracle's function
catalog so real SQL can never be shadowed. Bundles are a column or
struct_pack(named := exprs); PARTITION BY fits a clone per group.
Per AmirHossein's scoping: no desugaring (that optimization comes
later) and no sklearn.* namespace yet — fit literally runs the sklearn
object per group via a new plan step kind ("fit"), and a new batch
transform(table) runs serving_sql through DuckDB then applies the
fitted clones over helper feature/key columns, splicing outputs in
place. Unseen groups get NULL (the exact-join policy). infer through
Confit stays NotImplemented.
Gate: transformer columns check against an independent clone-per-group
sklearn reference; SQL columns unchanged (bit-exact vs DuckDB). Named
refusals: unknown names, ORDER BY/frames/FILTER on transformer windows,
non-final levels, nested calls, fn(*) (the parser erases the star),
unnamed struct fields, namespaced names. Root pytest 507+1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ahrzb
approved these changes
Jul 29, 2026
Converged design dialogue 2026-07-29: per-group weights as params data (instance ids over the existing join), a declared scalar-UDF protocol with PythonTransform as subclass, InferFn udfs= API, extern helper family in Confit. Parked until the go. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loop 5, scoped per the design dialogue: no desugaring (the optimization pass comes later), no
sklearn.*namespace (needs the sklearn index) — transformers are opaque objects and fit literally runs them. Spec:docs/superpowers/specs/2026-07-29-transformers-run-the-pipeline-design.md.transformers=registry, then caller scope (FROM dfidiom), guarded byduckdb_functions()so a local variable can never shadow real SQL. Captured objects surface onp.transformers.FitStep(kind="fit", transformer, features, keys)reading the level table; the executor grows one branch (groupby keys →clone()→fit). Everything else (names, reads, DAG order) unchanged.transform(table)runsserving_sql(helper feature/key columns ride along), applies fitted clones per group, splices each output column in place of its helper block. Unseen group → NULL, the exact-join policy.fn(*)(the parser erases the star — refused loudly rather than silently fitting zero features), unnamed struct fields, and namespaced names.Root pytest 507 passed + 1 xfailed; confit untouched.
🤖 Generated with Claude Code