Skip to content

Remove the legacy Delta Lake reader - #128445

Merged
alexey-milovidov merged 8 commits into
masterfrom
remove-legacy-delta-lake-impl
Nov 7, 2026
Merged

alexey-milovidov merged 8 commits into
masterfrom
remove-legacy-delta-lake-impl

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Remove the legacy Delta Lake reader (DeltaLakeMetadata, the C++ _delta_log parser). Delta Lake tables are now always read through delta-kernel-rs (DeltaLakeMetadataDeltaKernel). The legacy reader was used only when allow_delta_kernel_rs = 0, and it lacked partition pruning, time travel, change data feed, and writes. The DeltaLake* engines and table functions were already available only in builds with USE_DELTA_KERNEL_RS. The only users of the legacy reader in builds without the kernel (e.g. MSan) were Delta Lake tables of Unity catalog databases: such tables are now marked unreadable there, so they stay listed and a read reports that the server is built without delta-kernel-rs.

  • DeltaLakeMetadataDeltaKernel is now the metadata class of the DeltaLake, DeltaLakeS3, DeltaLakeAzure, and DeltaLakeLocal configurations.
  • The session setting allow_delta_kernel_rs (alias allow_experimental_delta_kernel_rs) is obsolete and does nothing.
  • The partition-column workaround for the legacy reader is removed from StorageObjectStorageSource and ReadFromObjectStorageStep.
  • The Delta JSON schema type parsing that the Unity catalogs use moved to DeltaLake/DeltaSchemaJSON (getDeltaLakeFieldType, getDeltaLakeSimpleTypeByName).
  • In builds without the kernel, the Unity catalogs mark Delta Lake tables unreadable at metadata time instead of failing in getConfiguration, which also failed the whole system.columns listing of the database.
  • Azure workload identity (extra_credentials(client_id = ..., tenant_id = ...), use_workload_identity disks, keyless URLs), which only the legacy reader supported, is now passed to delta-kernel-rs.
  • Configurations that only the legacy reader could read stop working: S3-compatible GCS tables that authenticate with http_client = 'gcp_oauth' (the metadata client of delta-kernel-rs cannot send the bearer token and reads _delta_log unsigned, as it already did with the default settings), and Azure blobs whose names begin with / (object_store cannot address them; move the table under keys without the leading slash).
  • Tests that covered only the legacy reader are removed; tests that covered both readers now cover only the kernel. In the integration tests, the nodes with the kernel disabled are removed, so Azure cases that ran there now run with the kernel.

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The legacy Delta Lake reader was removed, and Delta Lake tables are always read with delta-kernel-rs. The setting allow_delta_kernel_rs (allow_experimental_delta_kernel_rs) is obsolete and has no effect. Delta Lake tables on GCS that rely on http_client = 'gcp_oauth' and Azure blobs with a leading / in their names are no longer readable.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/128445]

Version info

  • Merged into: 26.11.1.1616-master (included in 26.11 and later)

alexey-milovidov and others added 2 commits October 31, 2026 23:58
Delta Lake tables are now always read through `delta-kernel-rs`
(`DeltaLakeMetadataDeltaKernel`). The legacy C++ `DeltaLakeMetadata`, which was used
with `allow_delta_kernel_rs = 0`, is removed together with the partition-column
crutch in `StorageObjectStorageSource` and `ReadFromObjectStorageStep`.

The `DeltaLake*` engines and table functions were already registered only with
`USE_DELTA_KERNEL_RS`, so no build loses functionality.

`allow_delta_kernel_rs` (alias `allow_experimental_delta_kernel_rs`) is obsolete.

The Delta JSON schema type parsing used by the Unity catalogs is moved to
`DeltaLake/DeltaSchemaJSON`.

Tests that only covered the legacy reader are removed; tests covering both readers
keep the kernel variant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Nov 3, 2026, 9:09 PM

@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8cfeeab]

Summary: ✅


AI Review

Summary

This PR removes the legacy Delta Lake reader and makes delta-kernel-rs mandatory, retaining allow_delta_kernel_rs as an obsolete setting. At head 8cfeeab133d19cb712840d861998344ec86efe48, one authentication compatibility regression remains: private GCS tables using gcp_oauth lose their working reader.

Findings

⚠️ Majors

  • [P1] Preserve GCS OAuth authentication. DataLakeConfiguration.h:621 forces existing tables onto S3KernelHelper. For http_client = 'gcp_oauth', the C++ client intentionally exposes empty AWS credentials and adds its bearer token in PocoHTTPClientGCPOAuth::makeRequestInternal. The kernel helper copies those empty credentials, enables aws_skip_signature, and never receives the bearer token. Its _delta_log requests are anonymous, so private tables that worked with allow_delta_kernel_rs = 0 become unreadable. Forwarding configured extra_headers does not cover this dynamically generated authentication. Preserve GCS OAuth authentication and token refresh in the kernel metadata path.
Tests
  • ⚠️ Add a focused authenticated Delta snapshot read using a gcp_oauth named collection, including token refresh. The existing OAuth mock infrastructure in tests/integration/test_storage_gcp_auth could be reused. This review established the regression through source tracing; no local runtime test was run.
Final Verdict

⚠️ Request changes. Preserve the supported GCS OAuth read path and add focused regression coverage before removing the opt-out.

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Nov 1, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Nov 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 8cfeeab13 with master d6bf47a42 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 5c48e43bc; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: object file sizes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes ⚠️

28 object files changed (+373.36 KiB total), 1 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Storages/ObjectStorage/DataLakes/DeltaLake/DeltaSchemaJSON.cpp.o new 366.14 KiB +366.14 KiB
src/CMakeFiles/dbms.dir/Storages/ObjectStorage/StorageObjectStorageSource.cpp.o 1.11 MiB 1.07 MiB -36.14 KiB (-3.19%)
src/CMakeFiles/dbms.dir/Storages/ObjectStorage/DataLakes/DeltaLake/KernelHelper.cpp.o 247.81 KiB 266.58 KiB +18.77 KiB (+7.57%)

720 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

54 translation units recompiled, 463 s compile time in total, 53 of them have a recent master baseline.

Job report

alexey-milovidov and others added 3 commits November 2, 2026 08:18
Azure keeps a leading slash as a part of the blob name, so the default
uploader stored the table under `/var/lib/...`, while the table location
of `delta-kernel-rs` is `az://container/var/lib/...`, and the kernel
reported "No files in log segment". The Azure cases previously ran only
with the legacy reader. Upload with relative blob names, as
`test_storage_delta` already does.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128445&sha=868b6cdf686c54bc23026a39725e2ce728a2e19f&name_0=PR
PR: #128445

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the legacy reader removed, every Delta Lake read goes through the
kernel, but `getAzureBuilderOptions` rejected `WorkloadIdentityCredential`
with `NOT_IMPLEMENTED`. This credential is used for
`extra_credentials(client_id = ..., tenant_id = ...)`, for disks with
`use_workload_identity`, and for an Azure URL without a key or a SAS.

Pass the workload identity to the object store of the kernel
(`azure_client_id`, `azure_tenant_id`, `azure_federated_token_file`,
`azure_authority_host`) with the same defaults from the environment as
the Azure SDK. The explicit `client_id` and `tenant_id` are kept in
`ConnectionParams`, because the credential does not expose them. If a
parameter is missing, throw instead of letting the object store silently
use the managed identity of the machine. With the anonymous fallback for
server credentials, the request is unsigned as for other credentials.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Builds without `delta-kernel-rs` (MSan) used to read Delta Lake tables of a
Unity catalog with the legacy reader. Now there is no Delta Lake reader there,
and reading such a table failed deep in `getConfiguration`, which also failed
the whole `system.columns` listing of the database. Mark these tables
unreadable at metadata time instead: they stay listed, a direct read reports
the reason, and listings that need the table metadata skip them, as for other
unreadable tables.

In `test_database_unity_v2`, skip the tests that need a Delta Lake reader
without the kernel, and let the authentication tests read the UniForm copy of
the table (read as Iceberg) there.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128445&sha=225b21e0945517b224ea0da85fdb3fc43354f2f6&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%20targeted%29
PR: #128445

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits November 3, 2026 20:35
Without `delta-kernel-rs` (MSan), Delta Lake tables of a Unity catalog are now
marked unreadable, so `SHOW CREATE TABLE` shows `ENGINE = Other` for the direct
(Delta) arm. Check only that the table is not routed to Iceberg there, and
require `DeltaLake` when the kernel is available.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128445&sha=d57094cb47178bd87382c229be2c8c26467e4dc1&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%20targeted%29
PR: #128445

Co-Authored-By: Claude Opus 5.5 <[email protected]>
started_cluster.blob_service_client,
started_cluster.azure_container_name,
use_relpath=True,
).upload_directory(delta_path, delta_path.lstrip("/"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve the existing Azure disk blob keys

AzureStorageParsedArguments::fromDisk prepends / to the table's path suffix, and the removed reader passed that path unchanged to the Azure SDK. Existing disk tables therefore read literal blob keys such as /var/lib/clickhouse/user_files/table/_delta_log/..., as the previous fixture did. AzureKernelHelper::normalizeBlobPath strips this significant slash, so making the kernel mandatory points the same persisted table definition at var/lib/clickhouse/user_files/table/... instead. Existing tables become unreadable; if both prefixes contain tables, it can select the other table.

Changing the uploaded keys here makes the test pass without covering the pre-upgrade layout. Please retain coverage using the previous blob keys and preserve their meaning in the kernel path, or provide an explicit migration path before removing their working reader.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵 The kernel cannot address these keys at all, so this is not something the kernel path can preserve: object_store's Path::parse strips the leading / and rejects empty segments, so a blob name like /var/lib/... (a leading empty segment under the container) cannot be represented. That is why AzureKernelHelper::buildTableLocation normalizes the slash. This normalization was already on master, and allow_delta_kernel_rs already defaults to true there. So disk-based Azure Delta tables already resolve to az://container/var/lib/... with default settings, and only the explicit allow_delta_kernel_rs = 0 opt-out read the literal leading-slash keys. Such keys also never come from Delta writers (Spark, delta-rs, and the kernel all write without the leading slash), only from manual uploads through the Azure SDK, as the old fixture did. The migration path is to place the table under keys without the leading slash, which is what the updated test does. The PR is categorized as a Backward Incompatible Change for this reason.

The kernel reads `_delta_log` through its own `object_store` client, which
received only the credentials, region and endpoint. A Delta table whose
transaction log is encrypted with SSE-C (`server_side_encryption_customer_key_base64`
of the endpoint or disk) or that lives in a requester-pays bucket
(`x-amz-request-payer: requester` header) could be read by the legacy reader,
but not by the kernel. Take the SSE-C key and the requester-pays header from
the extra headers of the live S3 client (the same one that reads the data
files) and pass them as `aws_server_side_encryption` /
`aws_sse_customer_key_base64` and `aws_request_payer`.

Address review: #128445 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#if USE_PARQUET && USE_DELTA_KERNEL_RS
#if USE_AWS_S3
using StorageS3DeltaLakeConfiguration = DataLakeConfiguration<StorageS3Configuration, DeltaLakeMetadata>;
using StorageS3DeltaLakeConfiguration = DataLakeConfiguration<StorageS3Configuration, DeltaLakeMetadataDeltaKernel>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve GCS OAuth authentication in the mandatory reader

A private GCS Delta table configured with http_client = 'gcp_oauth' through a named collection or disk can use the legacy reader with allow_delta_kernel_rs = 0. That HTTP client deliberately uses an anonymous AWS credentials provider (src/IO/S3/Credentials.cpp:1482-1484); PocoHTTPClientGCPOAuth::makeRequestInternal adds the Google bearer token later (src/IO/S3/PocoHTTPClient.cpp:932). However, S3KernelHelper::createBuilder copies only AWS credentials and enables aws_skip_signature when those credentials are empty. Its separate metadata client therefore sends anonymous _delta_log requests, which private buckets reject. The newly forwarded extra_headers do not contain this dynamically generated bearer token.

Making this alias unconditional removes the working reader for those tables, and the obsolete setting cannot restore access. Please preserve the configured GCS OAuth authentication, including token refresh, in the kernel metadata path and cover an authenticated Delta snapshot read before removing the opt-out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵 This is a real gap, but it is not new with this PR and the kernel path cannot be fixed from the ClickHouse side alone:

  • allow_delta_kernel_rs already defaults to true on master, and master's S3KernelHelper::createBuilder already sets aws_skip_signature when the client has no AWS credentials. So with default settings a gcp_oauth Delta table on a private GCS bucket already reads _delta_log anonymously today; only the explicit allow_delta_kernel_rs = 0 opt-out avoided it.
  • The kernel's metadata client is object_store's AmazonS3Builder, configured only through string options passed via ffi::get_engine_builder / set_builder_option. It has no option for an arbitrary Authorization: Bearer header or a custom credential provider (only aws_* keys and generic client options without headers), so there is nothing to forward the token from PocoHTTPClientGCPOAuth::getBearerToken (or S3::Client::getGCSOAuthToken) into. Supporting it, including refresh, requires an FFI extension in our delta-kernel-rs fork (a token callback, or a gs:// location with the GCS builder of object_store), which is a separate change.

The PR is already in the Backward Incompatible Change category for the removal of the opt-out; I will mention gcp_oauth there as well. A follow-up to extend the kernel FFI with a bearer-token provider is the proper fix; leaving this thread open for the reviewer to decide whether that should block the removal.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexey-milovidov alexey-milovidov self-assigned this Nov 7, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 7, 2026
Merged via the queue into master with commit 27662da Nov 7, 2026
187 checks passed
@alexey-milovidov
alexey-milovidov deleted the remove-legacy-delta-lake-impl branch November 7, 2026 16:59
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 7, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

@alexey-milovidov — title/description suggestions:

Description (currently incomplete):

  • Why: The body does not mention commit 8cfeeab, which changes behaviour for every S3 Delta table: S3KernelHelper::createBuilder now forwards the SSE-C key (aws_server_side_encryption = sse-c, aws_sse_customer_key_base64) and requester-pays (aws_request_payer) from the client's extra_headers to the kernel's object_store. It also does not say that this passthrough has no test.

  • Suggested addition:

    • The SSE-C key (server_side_encryption_customer_key_base64 of the endpoint or disk, or an x-amz-server-side-encryption-customer-key header) and x-amz-request-payer: requester are now passed to the object_store client of delta-kernel-rs, so _delta_log reads and kernel commits use them as the data-file reads already did. Not covered by a test (needs TLS S3).

Ignore if intentional.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 9, 2026
The MSan build has no delta-kernel-rs (contrib/delta-kernel-rs-cmake/CMakeLists.txt
disables it for SANITIZE=memory), and since ClickHouse#128445 removed the legacy Delta Lake
reader, UnityCatalog::tryGetTableMetadata marks a Delta table unreadable on such a
build. The schema exception the test asserts is then swallowed, DESCRIBE fails with
the delta-kernel-rs error instead, and the grep prints nothing. Same tag as the
other Delta Lake tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 18, 2026
ClickHouse#128445 removed the legacy Delta Lake reader, and `allow_delta_kernel_rs`
is now an obsolete setting that does nothing, so the two
`--allow_delta_kernel_rs=0` reads ran the kernel reader again and only
repeated the kernel reads of the same `ts` and `ts_ntz` tables above them.
The merge took the deletion of `DeltaLakeMetadata.cpp`, which dropped this
PR's UTC parse in its `getFieldValue`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-delta-lake Delta Lake tables: reading Delta metadata through delta-kernel-rs (table snapshots, schema and ty... and removed comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-delta-lake Delta Lake tables: reading Delta metadata through delta-kernel-rs (table snapshots, schema and ty... pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants