fix: preserve overwrite schema changes#5161
Open
LuciferYang wants to merge 3 commits into
Open
Conversation
Distributed create/overwrite writes assign Lance field ids positionally, so blocks whose columns arrive in a different order (e.g. a union of differently ordered sources) were committed under a single schema and read back transposed. Add a guard in LanceDatasink.on_write_complete that raises on inconsistent column order, and align Arrow blocks by name in pd_to_arrow so an explicit schema writes correctly. Also harden the schema-evolution mode plumbing: document per-mode schema behaviour (append validates/drops; create and overwrite evolve the schema), fix the LanceDatasink default-mode docstring, document the write_fragment mode parameter and the writer/committer mode-pairing requirement, and add regression tests for multi-fragment overwrite, schema drop/type-change, streaming overwrite resume, streaming-append rejection, and the column-order guard.
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.
Summary
LanceFragmentWriterand streaming writes, with later streaming batches switching back to appendTesting
python -m ruff check .python -m ruff format --check lance_ray/fragment.py lance_ray/datasink.py lance_ray/io.py tests/test_basic_read_write.pypython -m pytest tests/test_basic_read_write.py tests/test_fragment.py tests/test_blob.py::test_stream_copy_basic_local tests/test_blob.py::test_stream_copy_resume_local tests/test_blob_v2.py::test_blob_v2_append_with_target_bases_stream -qCloses #95