Repository navigation
[Data][Delta DSv2 features][2/5] Read column-mapped Delta tables (name mode) on DataSource V2 - #68505
Draft
abhishekverma-ray wants to merge 1 commit into
Conversation
abhishekverma-ray
force-pushed
the
abhishek/delta-features-2-column-mapping-name
branch
from
November 25, 2026 02:54
8848581 to
ee5cc6f
Compare
abhishekverma-ray
force-pushed
the
abhishek/delta-features-1-min-version
branch
from
November 25, 2026 02:54
d1c0572 to
38f3321
Compare
A column-mapped Delta table's data files name every column, nested fields too, by a physical name such as `col-5f4a...`; only the log maps it to the table's column name. read_delta raised for these tables (DATA-3770's guard), because reading the files by the logical names returns nulls. The DataSourceV2 reader now reads the name mode: - DeltaColumnMapping holds the table schema, whose field metadata carries each physical name. - The reader scans each file by physical names: the projected columns, the pinned schema (nested fields included) and the pushed-down filter, so Parquet statistics still prune row groups. It relabels the result to the logical names without copying (Array.view). A filter on a column with nested fields may name those fields logically, so it runs after the rename. - deltalake reports the add actions' statistics under physical names (min.col-..., nested as dotted paths) but partition values under logical ones. load_add_actions renames the statistics, so log-statistics skipping is unchanged. The footer reads get the filter and projection in physical names. - Columns the files hold but the table doesn't (materialized row-tracking columns) are never read; the partition column Databricks also writes into the files is ignored, as its values come from the log; files written before a column was added get nulls, as for any file missing a column. The id mode still raises, and so does the V1 reader for any mode. Tests use a hand-written log (write_mapped_table) shaped like a Databricks table: physical names, a nested field, the partition column and a row-tracking column in the files, a column missing from the older file, and physical-name statistics. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abhishek Verma <[email protected]>
abhishekverma-ray
force-pushed
the
abhishek/delta-features-1-min-version
branch
from
November 26, 2026 03:34
38f3321 to
198fec0
Compare
abhishekverma-ray
force-pushed
the
abhishek/delta-features-2-column-mapping-name
branch
from
November 26, 2026 03:34
ee5cc6f to
56f7081
Compare
This branch has not been deployed
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
The Delta DataSourceV2 reader now reads tables with column mapping in the
namemode. These tables' data files name every column, nested fields included, by a physical name such ascol-5f4a..., which only the Delta log maps to the table's column name. Part of #64854.Before
read_deltaraisedNotImplementedErrorfor column-mapped tables: reading the files by the table's column names returns nulls.After
DeltaColumnMappingholds the table schema; each field's metadata carries its physical name.DeltaFileReaderscans each file by physical names: the projected columns, the pinned schema (nested fields included) and the pushed-down filter, so Parquet statistics still prune row groups. It relabels the result to the logical names without copying (Array.view). A filter on a column with nested fields may name those fields logically, so it runs after the rename.deltalakereports theaddactions' statistics under physical names (min.col-..., nested fields as dotted paths) but partition values under logical ones.load_add_actionsrenames the statistics, so log-statistics skipping is unchanged. The footer reads get the filter and projection in physical names.idmode still raises here; [Data][Delta DSv2 features][3/5] Read column-mapped Delta tables (id mode) on DataSource V2 #68506 adds it. The V1 reader still raises for any mode.flowchart TD subgraph Before subgraph BS[Subsystem: IO] subgraph BC[Component: formats/delta] B0["check_delta_table_is_readable"] -->|column mapping| BX["NotImplementedError"] end end end subgraph After subgraph AS[Subsystem: IO] subgraph AC[Component: formats/delta] A1["load_add_actions: rename statistics to logical names"] --> A2["DeltaFileIndexer: footer filter in physical names"] A2 --> A3["DeltaFileReader: scan by physical names, then view as logical"] end end end classDef removed fill:#ffcdd2,stroke:#c62828,color:#000 classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000 classDef changed fill:#fff9c4,stroke:#f9a825,color:#000 class BX removed class A1,A3 added class A2 changedSubsystems
IO (
_internal/datasource_v2/formats/delta/, newdelta_column_mapping.py); docs in theread_deltadocstring.Not a duplicate
Issue #64854 asks for column mapping; no open PR implements it (searched open PRs for "delta column mapping").
Testing
Local: pyenv with deltalake 1.5.0 and pyarrow 23.
test_delta.py68,test_delta_v2.py64,tests/datasource_v2/test_delta_footer_listing.py3,unit/datasource_v2/test_delta_file_indexer.pyandtest_delta_datasource_v2.py55,test_delta_file_pruning.py52 andtest_pickle_gate_coverage.py117, all passed.write_mapped_tablewrites the log by hand, shaped like a Databricks table: physical names, a nested field, the partition column and a row-tracking column in the files, a column missing from the older file, and physical-name statistics.test_reads_a_mapped_tablecovers all rows, a filter, a partition filter, a filter on the nested column and a projection. All five fail with the reader's translation turned off.test_name_mapped_statistics_skip_files(intests/datasource_v2/test_delta_footer_listing.py, which lists the table asread_deltadoes) checks the statistics come back under logical names (fails without the rename) and that the listing skips the file the filter rules out.test_name_mapped_table_counts_from_the_logcheckscount().test_delta_read_column_mapping: V1 still raises; V2 reads the name mode.delta_column_mapping.pyjoins the pickle-gate allowlist: its only.to_arrow()converts the log's schema.AI assistance was used (Claude Code); every line has been reviewed by the submitter.
🤖 Generated with Claude Code