Repository navigation
Remove the legacy Delta Lake reader - #128445
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [8cfeeab] Summary: ✅
AI ReviewSummaryThis PR removes the legacy Delta Lake reader and makes Findings
Tests
Final Verdict |
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| 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.
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]>
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("/")) |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
🕵 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>; |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
🕵 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_rsalready defaults totrueon master, and master'sS3KernelHelper::createBuilderalready setsaws_skip_signaturewhen the client has no AWS credentials. So with default settings agcp_oauthDelta table on a private GCS bucket already reads_delta_loganonymously today; only the explicitallow_delta_kernel_rs = 0opt-out avoided it.- The kernel's metadata client is
object_store'sAmazonS3Builder, configured only through string options passed viaffi::get_engine_builder/set_builder_option. It has no option for an arbitraryAuthorization: Bearerheader or a custom credential provider (onlyaws_*keys and generic client options without headers), so there is nothing to forward the token fromPocoHTTPClientGCPOAuth::getBearerToken(orS3::Client::getGCSOAuthToken) into. Supporting it, including refresh, requires an FFI extension in ourdelta-kernel-rsfork (a token callback, or ags://location with the GCS builder ofobject_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 — title/description suggestions: Description (currently
Ignore if intentional. |
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]>
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]>
Remove the legacy Delta Lake reader (
DeltaLakeMetadata, the C++_delta_logparser). Delta Lake tables are now always read throughdelta-kernel-rs(DeltaLakeMetadataDeltaKernel). The legacy reader was used only whenallow_delta_kernel_rs = 0, and it lacked partition pruning, time travel, change data feed, and writes. TheDeltaLake*engines and table functions were already available only in builds withUSE_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 withoutdelta-kernel-rs.DeltaLakeMetadataDeltaKernelis now the metadata class of theDeltaLake,DeltaLakeS3,DeltaLakeAzure, andDeltaLakeLocalconfigurations.allow_delta_kernel_rs(aliasallow_experimental_delta_kernel_rs) is obsolete and does nothing.StorageObjectStorageSourceandReadFromObjectStorageStep.DeltaLake/DeltaSchemaJSON(getDeltaLakeFieldType,getDeltaLakeSimpleTypeByName).getConfiguration, which also failed the wholesystem.columnslisting of the database.extra_credentials(client_id = ..., tenant_id = ...),use_workload_identitydisks, keyless URLs), which only the legacy reader supported, is now passed todelta-kernel-rs.http_client = 'gcp_oauth'(the metadata client ofdelta-kernel-rscannot send the bearer token and reads_delta_logunsigned, as it already did with the default settings), and Azure blobs whose names begin with/(object_storecannot address them; move the table under keys without the leading slash).Changelog category (leave one):
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 settingallow_delta_kernel_rs(allow_experimental_delta_kernel_rs) is obsolete and has no effect. Delta Lake tables on GCS that rely onhttp_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
26.11.1.1616-master(included in26.11and later)