fix(fast-path): preserve Arrow type when building new-column table#44
Open
FANNG1 wants to merge 1 commit into
Open
fix(fast-path): preserve Arrow type when building new-column table#44FANNG1 wants to merge 1 commit into
FANNG1 wants to merge 1 commit into
Conversation
pa.array(s.to_pylist()) loses type information: fixed_size_list<float32>[N] becomes list<double> because Python floats are float64 and list structure is inferred from Python lists. Use s.to_arrow().combine_chunks() to preserve the declared daft return type exactly. Fixes daft-engine#40
bed8628 to
48f49ca
Compare
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 #40
Problem
FastPathFragmentWriterbuilt the new-column Arrow table via:pa.array(s.to_pylist())loses Arrow type information. Python floats are alwaysfloat64and Python lists carry no fixed-size constraint, sofixed_size_list<item: float>[N](e.g. an embedding vector from a@daft.func.batch(return_dtype=DataType.fixed_size_list(DataType.float32(), 128))UDF) was silently widened tolist<item: double>. Lance then commits the wrong type in the schema.Fix
Use
s.to_arrow().combine_chunks()instead, which preserves the Arrow type that daft declared in the UDF'sreturn_dtype.Test
TestRegressions::test_fixed_size_list_float32_type_preserved— creates a UDF returningfixed_size_list<float32>[8], merges via fast path, and asserts the Lance schema preserves the type and values are non-null.