You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(codegen): struct/list containers — TASK-29 Phase B (Tasks 1–2 of 4) (#4)
* docs: TASK-29 Phase B plan — codegen struct/list containers
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(codegen): struct/list column passthrough — enable codegen for container output (TASK-29B-1)
Move struct and list column projection from deferred (UnsupportedInCodegen) to committed
surface. The output model + marshalling infrastructure already handles struct/list
Pydantic models. This unlocks struct/list passthrough for codegen, matching native
engine parity. DataFusion oracle validates.
Changes:
- sql_transform/_codegen/engine.py: Remove the guard block rejecting struct/list containers
- tests/test_codegen_coverage.py: Move struct/list passthroughs from _DEFERRED to _COMMITTED
- sql_transform/_codegen/engine_test.py: Update test to verify struct columns now pass through
Test results: 495 passed (+3), 11 skipped (-3)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* fix(codegen): drop unused import, reformat test, correct _to_native docstring (TASK-29B-1 review)
- Remove unused UnsupportedInCodegen import from engine_test.py (F401)
- Fix stray blank lines in engine_test.py via ruff format
- Update _to_native docstring: struct columns now reach projected output via passthrough,
not only via JOIN keys; removed false claim about UnsupportedInCodegen rejection
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(codegen): struct/list construction (named_struct/struct/array) — TASK-29 Phase B
Adds StructExpr/ListExpr IR: named_struct(...), struct(...)/STRUCT(...), and
array(...)/make_array(...)/[...] now build a Python dict/list at runtime
instead of raising UnsupportedInCodegen. _DEFERRED_FUNCS shrinks to
("unnest",).
Also tightens the Func emit path in engine.py: an unrecognized function name
(notably a transformer call, __tfm_N__) now raises UnsupportedInCodegen
instead of a generic ValueError -- this path was previously unreachable
because named_struct short-circuited before descending into its arguments;
completing named_struct exposed it. Updated plan_test.py's stale
"named_struct defers" assertion accordingly and added a focused unit test for
the new construction IR.
* fix(codegen): widen mixed-numeric list elements + narrow unknown-func defer to __tfm_ (TASK-29B-2 review)
- infer_type's ListExpr arm now unifies element types via _common_base
(same helper COALESCE uses), so make_array(int, float) types as
list[float] and pydantic widens the int element at model_validate
(measured: no emission-side change needed).
- _emit_expr's Func branch narrows the UnsupportedInCodegen defer to
__tfm_ transformer placeholders only; every other unknown function
name (e.g. foobar(x), invalid SQL) keeps the original hard ValueError
instead of being silently skipped by the differential harness.
* refactor(codegen): drop dead struct/array Anonymous branches (TASK-29B review)
struct(...) parses as exp.Struct and array(...) as exp.Array, both handled
by earlier _convert_expr arms; only make_array reaches the Anonymous arm.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(codegen): cover positional/named struct + make_array; fix stale comments (PR#4 review)
Auto-review flagged three committed codegen construction shapes with no value
test: positional struct(a,b) -> c0/c1, named struct(a AS x,...) (exp.PropertyEQ),
and make_array(...). All three match the DataFusion oracle on codegen but native
has no dispatch for them, so they xfail_on_native -- same parity-gap pattern as
the mixed-numeric widening test. Native gaps want their own tickets.
Also fixed two stale comments: plan.py claimed named_struct parses to exp.Struct
(it's exp.Anonymous), and test_transformer_case claimed codegen defers on
named_struct (it defers on the __tfm_0__ transformer call; named_struct is
supported now).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments