Skip to content

refactor: merge JsonConvertingReader into SchemaAdapter#7678

Open
xloya wants to merge 1 commit into
lance-format:mainfrom
xloya:refactor/merge-json-converting-reader-into-schema-adapter
Open

refactor: merge JsonConvertingReader into SchemaAdapter#7678
xloya wants to merge 1 commit into
lance-format:mainfrom
xloya:refactor/merge-json-converting-reader-into-schema-adapter

Conversation

@xloya

@xloya xloya commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the bespoke JsonConvertingReader in the merge/update path with SchemaAdapter::to_physical_reader, so the synchronous reader path shares the same logical-to-physical conversion as the write stream path. This resolves the TODO left in fix: convert Arrow JSON when updating columns via merge/update path #7472.
  • The two conversion entry points (to_physical_reader for sync RecordBatchReader, to_physical_stream for async SendableRecordBatchStream) now share a single physical_schema() helper and the same convert_json_columns + downcast_view_columns logic.
  • Side effect / fix: the update path now also downcasts Utf8View/BinaryView columns to their stored offset form (Utf8/Binary). Previously only Arrow JSON was converted, so a view-typed update column would have mismatched the physical schema.

Test plan

  • Extended test_update_columns_with_json_extension_type with a Utf8View column (desc) on both the dataset and the update stream, exercising the new view downcasting alongside the existing Arrow JSON conversion.

The merge/update path used a bespoke `JsonConvertingReader` that only
converted Arrow JSON columns, duplicating logic already present in
`SchemaAdapter`. Replace it with `SchemaAdapter::to_physical_reader` so
the sync reader path shares the same logical-to-physical conversion as
the write stream path (Arrow JSON -> Lance JSON, view types -> offset
types), resolving the TODO left in lance-format#7472.

As a result, the update path now also downcasts Utf8View/BinaryView
columns to their stored offset form, which previously would have
mismatched the physical schema. Extend the JSON extension update test
with a Utf8View column to cover this.
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/dataset/utils.rs 93.10% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@xloya

xloya commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

cc @wjones127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant