TASK-36: widen mixed int/float list elements on the native engine - #19
Closed
claude-agent-ahrzb[bot] wants to merge 1 commit into
Closed
TASK-36: widen mixed int/float list elements on the native engine#19claude-agent-ahrzb[bot] wants to merge 1 commit into
claude-agent-ahrzb[bot] wants to merge 1 commit into
Conversation
… — TASK-36 unify_list_element_types was exact-FieldType-equality only, so a list literal mixing an int column with a float column ([bedrooms, price_per_sqft]) left the int element un-widened on the native serving path -- [3, 12.5] -- while the DataFusion oracle and codegen both produced list<double> [3.0, 12.5]. No error, no warning: a silent cross-engine value divergence on the default serving engine, exactly the class the model consumes positionally. Now it uses common_base -- the same COALESCE/CASE widening the oracle uses (int+float -> float) -- so both engines emit list<double>. The output model types the list as list[float] and pydantic coerces the runtime int to float. AC#4 sweep: unify_list_element_types was the only exact-equality-only unification site where DataFusion widens. common_base already widens (COALESCE/CASE), binary_op_type widens int+float -> float, and compatible() already accepts Int -> Float. No other silent-divergence site of this class. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
Closing as obsolete: the SQLTransform line this targets has been reset (#54). The DataFusion native engine, the codegen backend, and the batch transform() path are removed; what remains is the confit-served fit-and-serve path. Nothing here is lost — the branch and its commits stay reachable if this work is ever revived. |
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.
Fixes a silent cross-engine value divergence on the default serving engine.
What a user hits
No error, no warning. The int element silently stays int on the serving path and becomes float on the training path. Anything dtype-sensitive downstream — a numpy cast, a model expecting float64, a feature vector checked against a stored schema — then sees different data in training vs production, and nothing points at the list literal.
Root cause (measured)
native'sunify_list_element_types(src/types.rs) was exact-FieldType-equality only, so it refused to widen mixed numeric elements and fell back toBase::Other. DataFusion (oracle) and codegen both widen tolist<double>.The fix — AC#1: mirror the COALESCE/CASE widening the oracle already uses
common_baseis the existing function COALESCE/NULLIF and CASE already use, and it already matches the oracle. So this inherits the oracle-verified promotion rule rather than defining a new one — no promotion lattice invented. The output model types the list aslist[float]and pydantic coerces the runtime int to float, exactly as codegen does.AC#4 — root-cause sweep
unify_list_element_typeswas the only exact-equality-only unification site where DataFusion widens. Verified the other type-combination sites are already correct:common_base(COALESCE/CASE/NULLIF)binary_op_type(arithmetic)compatible()(struct/list matching)(Int, Float) => trueNo other silent-divergence site of this class.
Verification
SELECT [x, y]with int+float now yields[1.0, 2.5]on native, matching the oracle.xfail_on_nativemarker ontest_list_construct_mixed_numeric_widensis removed in this same commit; it now passes on both engines.[native]while[codegen]still passes — so it genuinely catches the regression.src/types.rs+tests/test_diff_types.py.🤖 Generated with Claude Code