Repository navigation
Unify File/object-storage engines under the URL engine - #106093
Conversation
Make the `URL` table engine and the `url` table function dispatch to the
right backend based on the URL scheme, so a single uniform `url('<scheme>://...')`
works regardless of where the data lives:
- `file://` -> `File`
- `s3://`, `gs://`, `gcs://`, `oss://`, `cos://`, ... -> `S3`
- `az://`, `azure://`, `abfss://` -> `AzureBlobStorage`
- `hdfs://` -> `HDFS`
- `http://`, `https://` and anything else -> the `URL` engine itself (unchanged)
The dispatch reuses the existing engines by delegation rather than duplicating
read/write/inference logic. The `url` table function builds the matching
delegate table function via `TableFunctionFactory::get` and forwards schema
inference, execution and the access-check engine name to it. The `URL` storage
engine creator invokes the target engine's registered creator looked up from
`StorageFactory`.
Scheme classification happens after the existing `url_base` relative-URL
resolution, so a relative reference is first resolved against the base and then
routed to the matching engine. `gcs` is added to the default S3 scheme mapper.
This implements item 1 of #59617
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [0b235b0] Summary: ✅
AI ReviewSummaryThis PR makes the Final VerdictStatus: ✅ Approve |
…ngine dispatch The `Style check` job flagged the `catch (...)` in `registerStorageURL` (unified URL engine scheme dispatch) as silently swallowing exceptions. The catch is intentional: when the first engine argument is not a positional string literal (e.g. a named collection), we fall through to the plain `URL` engine behavior. Move the explanatory comment onto the `catch` line and mark it with `Ok:` so the `check_catch_all` style rule recognizes it as deliberate. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ispatch Follow-up to the URL-engine scheme dispatch, addressing the automated review on PR #106093: - Persistence: the `URL` engine no longer mutates the persisted `ENGINE = URL(...)` arguments when dispatching. The delegate storage is built from a separate argument list and wrapped in a `StorageProxy` (`StorageURLSchemeDispatch`) that keeps the IStorage no-op `addInferredEngineArgsToCreateQuery`, so `SHOW CREATE`, `DETACH`/`ATTACH` and restart keep the original `URL(...)` syntax and re-dispatch on reload. This also avoids a `LOGICAL_ERROR` from the Azure engine, which requires at least 3 arguments. - Access control: dispatching now re-checks `TABLE ENGINE` privilege for the target engine on `CREATE`, so a user granted only `URL` cannot create File/S3/Azure/HDFS backed tables. The `url` table function reports the delegate's source as its function URI so source-access filters apply to the resolved path/URL. - Argument forms: the engine classifies the scheme via a cloned `getConfiguration`, so key-value and named-collection `url=` forms dispatch consistently. - `headers(...)` is now rejected with a clear error when dispatching to a non-URL scheme, instead of being silently dropped. - `gcs` is added to the default `url_scheme_mappers` in `config.xml` (the config overrides the built-in fallback, so the fallback entry alone was not enough). - Tests: added regressions for reload-safety (`system.tables` engine + `DETACH`/`ATTACH`) and `headers(...)` rejection. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ith Ok The check_catch_all style rule flags the catch(...) around the probe getConfiguration in tryDispatchURLEngineByScheme. The catch is intentional: when the arguments are not a URL-engine shape we can classify, we fall through to the plain URL engine path which reports any real errors. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…unify-url-engine-dispatch # Conflicts: # src/Storages/StorageURL.cpp
|
Addressed the automated review (pushed as follow-up commits):
The three CI failures on the previous commit were unrelated to this change (Stress |
… in URL dispatch
Two correctness fixes for the unified `URL` engine / `url` table function
scheme dispatch, flagged by the automated review after the previous follow-up:
- Schema-inferred metadata (`StorageURLSchemeDispatch`): for a `CREATE TABLE t
ENGINE = URL('file://...')` without an explicit column list, `columns_` is
empty because the `URL` engine declares `supports_schema_inference` and the
structure is inferred inside the delegate storage constructor. The proxy used
to initialize its metadata from the empty `columns_`, so it persisted an empty
column list and exposed a snapshot with no physical columns. It now copies the
inferred columns from the delegate when explicit columns were not provided.
- Delegated source-access URI (`TableFunctionURL`): `buildDelegate` approximated
the delegate's access URI as `filename` for every object-storage target. For
`AzureBlobStorage` the real `azureBlobStorage` source check uses
`StorageAzureConfiguration::getRawURI` (only `blob_path.path`), so filtered
source grants diverged from calling the delegate directly. The wrapper now
takes `delegate_function_uri` from the delegate's own `getFunctionURI`, which
is authoritative for all schemes (`file` → empty, `s3`/`hdfs` → full URL,
`azure` → blob path). `getFunctionURI` is made public for this.
Adds a regression for `ENGINE = URL('file://...')` without an explicit column
list (column count, reload across `DETACH`/`ATTACH`).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Follow-up addressing the remaining automated-review findings (commit d113abd):
|
…spatch # Conflicts: # src/Storages/StorageURL.cpp
…n scheme dispatch Fix four issues raised in review of the unified `URL` engine/function scheme dispatch: - `url_base` persistence: when a relative reference is resolved against `url_base` and dispatched to a backend, the wrapper now materializes the resolved URL back into the persisted `URL(...)` args (via the new static `StorageURL::materializeResolvedURLInEngineArgs`, extracted from `addInferredEngineArgsToCreateQuery`). Otherwise `DETACH`/`ATTACH` or restart without `url_base` would load the scheme-less reference as a plain `URL` table instead of re-dispatching to the original backend. Userinfo URLs are still skipped to avoid leaking credentials via `SHOW CREATE TABLE`. - `TRUNCATE`: `StorageURLSchemeDispatch` now overrides `supportsTruncate`/`truncate` to preserve the `URL` engine semantics (not supported), instead of forwarding to the delegate and silently truncating local files or removing object-storage keys under a table declared as `URL`. - `RENAME`: the wrapper now performs a metadata-only rename like a plain `URL` table, instead of forwarding to the delegate (which would move/remove backend data or throw for user-defined-file `File` delegates). - `urlCluster`: a non-`http(s)` scheme passed to `urlCluster` is now rejected with a clear error instead of silently building a non-clustered delegate and running the read on the initiator, ignoring the requested cluster. `isClusterFunction` is made protected so `TableFunctionURL` can branch on the cluster context. The regression test is extended to cover all four cases and renumbered to `04305` to avoid a collision with a test added on master. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`StorageURLSchemeDispatch` derives from `StorageProxy`, so calling `IStorage::renameInMemory` and `IStorage::truncate` from it is a grandparent virtual call that `clang-tidy` flags as `bugprone-parent-virtual-call` (warnings-as-errors in the `arm_tidy` build). - `renameInMemory`: the override was byte-identical to `StorageProxy::renameInMemory` (`nested->renameInMemory` followed by `IStorage::renameInMemory`), so it is removed entirely. The `rename` override calls the virtual `renameInMemory`, which now resolves to `StorageProxy::renameInMemory` with the same behavior. - `truncate`: must deliberately bypass `StorageProxy::truncate` (which forwards to the delegate and would truncate the backing file/object) and use the `IStorage` default, which throws. Annotated with `NOLINT(bugprone-parent-virtual-call)`, mirroring `StorageTableProxy`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106093&sha=e4623598db443198f57bc2529fce349ecb5ce180&name_0=PR&name_1=Build%20%28arm_tidy%29 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Fixed the
Also merged Remaining open automated-review thread — inferred |
The `URL` engine description exposed via `system.table_engines.description` listed only `abfss://` for the Azure backend, while `classifyURLScheme` dispatches both `abfss` and `abfs` and the Markdown docs (`docs/en/engines/table-engines/special/url.md`, `docs/en/sql-reference/table-functions/url.md`) already list `abfs://`. Add `abfs://` alongside `abfss://` in the in-server engine docs so all user-facing descriptions match the actual scheme contract. Addresses the automated review finding on `StorageURL.cpp`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the
The two CI failures are unrelated to this change (the PR touches neither test) and both have open tracking issues:
No |
|
Continue-PR status (automated pass, 2026-06-30): analysis + thread reply only — no code changes, no re-merge, no force actions. AI Review verdict: ✅ Approve ("no remaining blocking issues in the changed code"). Review threads: 28/29 resolved; 1 unresolved — @Michicosun's design question on CI (commit
Merge base: behind master but the last State: MERGEABLE / BLOCKED (awaiting human approval; @Michicosun review requested). |
…spatch # Conflicts: # src/Storages/StorageURL.cpp # src/TableFunctions/TableFunctionURL.cpp
|
Continue-PR status (automated pass, 2026-06-30): merged The branch was 740 commits behind
Verified the resolution compiles: CI before the merge: the sole non-flaky-infra failure was AI Review verdict: ✅ Approve. The one open review thread is a design discussion (regex vs. explicit |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 261/320 (81.56%) · Uncovered code |
|
Continue-PR status (automated pass, 2026-07-01): analysis + flaky-job rerun only — no code changes, no re-merge. CI on the current head
Review: AI Review verdict is ✅ Approve ("no remaining correctness, safety, or missing-evidence issue"). The single unresolved inline thread (regex vs. explicit No re-merge: merge base Effectively ready — blocked only on human approval and the private sync draining. |
|
Continue-PR status (automated pass, 2026-07-01): analysis only — no code changes, no re-merge, no reruns. CI on the current head
All 174 rollup checks are now AI Review verdict (current head): ✅ Approve — "no remaining correctness, safety, or missing-evidence issue." Review threads: 28/29 resolved. The single unresolved thread is @Michicosun's design question (regex matcher vs. the explicit No re-merge: merge base Effectively ready — blocked only on human approval (@Michicosun review requested). |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Ok, finished reviewing.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it, use `pg_strcasecmp` to compare `COPY` options like Postgres does. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it, use `pg_strcasecmp` to compare `COPY` options like Postgres does. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it, use `pg_strcasecmp` to compare `COPY` options like Postgres does. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it switch to using the Postgres option parsing functions to ensure we get valid values. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it switch to using the Postgres option parsing functions to ensure we get valid values. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it switch to using the Postgres option parsing functions to ensure we get valid values. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Set up a memory context callback to release the chDB connection when we exit, whether through an error, interrupt, or normal exit. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it switch to using the Postgres option parsing functions to ensure we get valid values. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
Implement the chDB streaming SELECT and INSERT logic to execute the queries sent to chDB. Just emit SELECT results as a NOTICE for now, and leave the scaffolding for sending INSERT data in a no-op loop for a NULL variable for now. Carefully copy an error message and free all of the chDB allocated memory before raising a Postgres exception, to keep memory management properly separated and clean. The one bit of funky-ness is stripping out a `Request ID:` line from an error message so that errors are consistent and thus testable. Set up a memory context callback to release the chDB connection when we exit, whether through an error, interrupt, or normal exit. Refactor the chDB query generation to use `auto` as the value for otherwise unset `format` and `structure` arguments; encapsulate this behavior in `append_format_structure_compression()`, since the S3, GCS, and ABS functions all handle these two arguments, along with `compression`, in the same way and order. Speaking of ABS, add `azureURLParts` and `parse_azure_url`, ported from ClickHouse/ClickHouse#106093, to extract the account URL, container name, and storage path from the URL and generate the `azureBlobStorage()` SQL with those parts. Also change the `gcs` URL to `https`, the scheme recognized by `gcs()`. Add a new `COPY` option, `timeout`, to allow the user to set a request timeout. Defaults to 30s. While at it switch to using the Postgres option parsing functions to ensure we get valid values. Add the `settings` constant and use it to construct settings for each query, appending those settings required for each function, including the timeout, as it varies for each function. Update the tests to call real public URLs on S3 and GCS. The `NOTICE`s show that their contents are properly fetched for `COPY FROM` unless the credentials are incorrect; `COPY TO` currently fails because we're not sending any data and because we don't have permission anyway.
…ispatch Follow-up to the URL-engine scheme dispatch, addressing the automated review on PR ClickHouse#106093: - Persistence: the `URL` engine no longer mutates the persisted `ENGINE = URL(...)` arguments when dispatching. The delegate storage is built from a separate argument list and wrapped in a `StorageProxy` (`StorageURLSchemeDispatch`) that keeps the IStorage no-op `addInferredEngineArgsToCreateQuery`, so `SHOW CREATE`, `DETACH`/`ATTACH` and restart keep the original `URL(...)` syntax and re-dispatch on reload. This also avoids a `LOGICAL_ERROR` from the Azure engine, which requires at least 3 arguments. - Access control: dispatching now re-checks `TABLE ENGINE` privilege for the target engine on `CREATE`, so a user granted only `URL` cannot create File/S3/Azure/HDFS backed tables. The `url` table function reports the delegate's source as its function URI so source-access filters apply to the resolved path/URL. - Argument forms: the engine classifies the scheme via a cloned `getConfiguration`, so key-value and named-collection `url=` forms dispatch consistently. - `headers(...)` is now rejected with a clear error when dispatching to a non-URL scheme, instead of being silently dropped. - `gcs` is added to the default `url_scheme_mappers` in `config.xml` (the config overrides the built-in fallback, so the fallback entry alone was not enough). - Tests: added regressions for reload-safety (`system.tables` engine + `DETACH`/`ATTACH`) and `headers(...)` rejection. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…Dispatch
The `URL` engine dispatches non-HTTP schemes to a delegate (`File`/object
storage) wrapped in `StorageURLSchemeDispatch`, which is a `StorageProxy`. The
proxy forwards `supportsSubcolumns` and `supportsPrewhere`, but it did not
forward `supportsOptimizationToSubcolumns`, `supportedPrewhereColumns` or
`canMoveConditionsToPrewhere`, so it fell back to the `IStorage` defaults that
advertise capabilities the delegate (and the plain `URL` engine) deliberately
reject:
- `IStorage::supportsOptimizationToSubcolumns` defaults to `supportsSubcolumns`
(true for `File`/object storage), so `FunctionToSubcolumnsPass` would rewrite
functions to subcolumn reads for `ENGINE = URL('file://...')`, while direct
`StorageFile` and plain `StorageURL` return `false`.
- `IStorage::supportedPrewhereColumns` defaults to `std::nullopt` (unrestricted)
and `IStorage::canMoveConditionsToPrewhere` to `supportsPrewhere`, so explicit
`PREWHERE` or auto-moved conditions could target default-expression or
hive-partition columns that `StorageFile`, `StorageObjectStorage` and plain
`StorageURL` exclude from `supportedPrewhereColumns`.
Forward all three methods to the delegate, mirroring `StorageAlias`. Add
`04402_url_engine_dispatch_planner_capabilities` asserting that
`ENGINE = URL('file://...')` does not get the subcolumn rewrite (with a
`MergeTree` control that does) and rejects `PREWHERE` on a default-expression
column while allowing it on a plain column.
Addresses the automated review on ClickHouse#106093
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-dispatch Unify File/object-storage engines under the URL engine
Make the
URLtable engine and theurltable function act as a unified wrapper that dispatches to the right backend based on the URL scheme, so a single uniformurl('<scheme>://...')works regardless of where the data lives:file://→Files3://,gs://,gcs://,oss://→S3az://,azure://,abfss://,abfs://→AzureBlobStoragehdfs://→HDFShttp://,https://and anything else → theURLengine itself (unchanged)Scheme classification happens after the existing
url_baserelative-URL resolution, so a relative reference is first resolved against the base and then routed to the matching engine.The dispatch reuses the existing engines by delegation rather than duplicating read/write/inference logic. The
urltable function builds the matching delegate table function viaTableFunctionFactory::getand forwards schema inference, execution and the access-check engine name to it. TheURLstorage engine creator invokes the target engine's registered creator looked up fromStorageFactory.gcsis added to the default S3 scheme mapper.Implements item 1 of #59617.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
URLtable engine andurltable function now dispatch to the appropriate backend based on the URL scheme:file://is served by theFileengine,s3:///gs:///gcs:///oss://byS3,az:///azure:///abfss:///abfs://byAzureBlobStorage,hdfs://byHDFS, andhttp(s)://by theURLengine as before. Theurl_basesetting is applied before scheme dispatch. Only the S3 schemes resolved by the defaulturl_scheme_mappersare dispatched; other S3-compatible vendor schemes (cos,obs, ...) are not, and require using thes3engine/function directly.Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.7.1.635(included in26.7and later)