Skip to content

[Data][Delta DSv2 features][3/5] Read column-mapped Delta tables (id mode) on DataSource V2 - #68506

Draft
abhishekverma-ray wants to merge 1 commit into
abhishek/delta-features-2-column-mapping-namefrom
abhishek/delta-features-3-column-mapping-id
Draft

abhishekverma-ray wants to merge 1 commit into
abhishek/delta-features-2-column-mapping-namefrom
abhishek/delta-features-3-column-mapping-id

Conversation

@abhishekverma-ray

@abhishekverma-ray abhishekverma-ray commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Delta DataSourceV2 reader now reads tables with column mapping in the id mode, where a data file's columns are matched to the table's columns by their Parquet field ids, not their names. After a rename, a file can use names that differ from the log's physical names. Completes #64854 for the V2 reader, on top of the name mode (#68505).

Before

read_delta raised NotImplementedError for the id mode.

After

  • DeltaColumnMapping names columns per data file. In the id mode it reads the file's own schema, which the scan opens anyway. It matches each table column, nested fields included, to the file column whose PARQUET:field_id equals the log's delta.columnMapping.id, then scans and renames by those names.
  • A column the file doesn't have keeps its physical name, which the file doesn't use either, so the scan fills it with nulls.
  • The name mode is unchanged.
  • The log keys statistics by physical name in both modes, so log-statistics skipping is unchanged. The footer reads get the filter in physical names; a file whose names differ keeps all its row groups there, which is safe.
  • check_delta_table_is_readable accepts both modes; only an unknown mode raises. The V1 reader still raises for column mapping.
flowchart TD
    subgraph Before
        subgraph BS[Subsystem: IO]
            subgraph BC[Component: DeltaFileReader]
                B1["names from the log's physical names"]
            end
        end
    end
    subgraph After
        subgraph AS[Subsystem: IO]
            subgraph AC[Component: DeltaFileReader]
                A0{"mode"} -->|name| A1["names from the log's physical names"]
                A0 -->|id| A2["names from the file's Parquet field ids"]
            end
        end
    end
    classDef added fill:#c8e6c9,stroke:#2e7d32,color:#000
    class A2 added
Loading

Subsystems

IO (formats/delta/delta_column_mapping.py, delta_scanner.py); docs in the read_delta docstring.

Not a duplicate

Issue #64854 asks for column mapping; no open PR implements it.

Testing

Local: pyenv with deltalake 1.5.0 and pyarrow 23.

  • pytest over test_delta.py, test_delta_v2.py, the Delta unit tests and test_pickle_gate_coverage.py: 363 passed.
  • The mapped-table tests now run in both modes. In the id mode, write_mapped_table writes files whose column names differ from the log's physical names, so only the field ids match. All five id-mode read cases fail without the field-id matching.
  • test_delta_read_column_mapping: V2 reads both modes; V1 raises.
  • pre-commit passes; pyrefly as CI runs it reports no errors in the changed files.

AI assistance was used (Claude Code); every line has been reviewed by the submitter.

🤖 Generated with Claude Code

In the id mode of Delta column mapping, a data file's columns are matched to
the table's columns by their Parquet field ids, not their names: after a
rename, a file can use names that differ from the log's physical names.

DeltaColumnMapping now names columns per data file. In the id mode it reads
the file's own schema (which the scan opens anyway), matches each table
column, nested fields included, to the file column whose PARQUET:field_id
equals the log's delta.columnMapping.id, and scans and renames by those
names. A column the file doesn't have keeps its physical name, which the
file doesn't use either, so the scan fills it with nulls. The name mode is
unchanged.

The log keys statistics by physical name in both modes, so log-statistics
skipping is unchanged. The footer reads get the filter in physical names;
a file whose names differ keeps all its row groups there, which is safe.

check_delta_table_is_readable now accepts both modes; only an unknown mode
raises. The V1 reader still raises for column mapping.

The mapped-table tests run in both modes. In the id mode the helper writes
files whose column names differ from the log's physical names, so only the
field ids match; the reads fail without the id matching.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abhishek Verma <[email protected]>
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-features-2-column-mapping-name branch from ee5cc6f to 56f7081 Compare November 26, 2026 03:34
@abhishekverma-ray
abhishekverma-ray force-pushed the abhishek/delta-features-3-column-mapping-id branch from e88a583 to 78aa4f3 Compare November 26, 2026 03:34

This branch has not been deployed

No deployments
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