Repository navigation
Cherry pick #122707 to 26.10: Fix loading AzureBlobStorage tables whose engine arguments end with partition_strategy = 'none' - #129077
Merged
robot-ch-test-poll4 merged 11 commits intoNov 4, 2026
Conversation
… parser Since #115277 the server persists an implicit `none` partition strategy of an object storage table as a trailing `partition_strategy = 'none'` engine argument, for S3 and Azure. The Azure readers of a positional argument list, `AzureStorageParsedArguments::fromAST` and `addStructureAndFormatToArgsIfNeededAzure`, evaluated every argument as a constant expression, so that `equals` node failed with UNKNOWN_IDENTIFIER. An AzureBlobStorage table created with PARTITION BY under `file_like_engine_default_partition_strategy = 'wildcard'` (the default for `compatibility` older than 26.6) could not be attached again, and the server did not start. Both readers now split off the trailing `identifier = value` arguments. `fromAST` accepts `partition_strategy` and `partition_columns_in_data_file` there, applies them like their positional forms and keeps the arguments in the AST as written. Other keys, a key given both positionally and as a key-value argument, and key-value arguments after fewer than three positional ones are rejected. The key must be an identifier, so a positional constant such as `1 = 1` keeps its meaning. `addStructureAndFormatToArgsIfNeededAzure` completes the positional arguments and appends the key-value ones back. The reading side is fixed because only it lets tables already written by 26.8 and 26.9 load again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…strategy A key-value `partition_strategy = 'hive'` in the AzureBlobStorage engine or the azureBlobStorage table function left `partition_columns_in_data_file` at the struct default `true` when the companion argument was absent, so the partition columns were written into every data file. The documented default is `false`, and the named-collection form of this engine and the S3 parser already compute it from the strategy. Apply the same default on the key-value path. An explicit `partition_columns_in_data_file` still wins. The positional forms keep their current value, because tables created with them already have data files written that way; the key-value path is new, so no existing table depends on it. The test gets two write arms against Azurite that count the columns of the written Parquet file: 1 by default, 2 with `partition_columns_in_data_file = 1`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the second line of the countPositionalArguments comment; the commit message of the fix already explains why `1 = 1` stays positional. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rguments The query an `azureBlobStorageCluster` initiator forwards to the replicas (and an `azureBlobStorage` query converted by `parallel_replicas_for_cluster_engines`) is rewritten by `addStructureAndFormatToArgsIfNeededAzure`, which evaluated every argument as a constant, including `extra_credentials(...)`. Such a query failed with UNKNOWN_IDENTIFIER `client_id` before anything was sent. The trailing key-value split of the previous commits made it order-dependent too: `fromAST` removes `extra_credentials` before it looks for the trailing `identifier = value` run, the rewrite did not, so `..., partition_strategy = 'none', extra_credentials(...)` was accepted by the parser and rejected by the rewrite. Set `extra_credentials` aside first and append it after the key-value arguments, as `addStructureAndFormatToArgsIfNeededS3` does. The test runs both argument orders of `azureBlobStorageCluster` and the parallel-replicas conversion, and checks in `system.query_log` that every initial query was forwarded with `extra_credentials`; the replicas then fail to send the workload-identity token over plain http. Without this change each query fails with Code 47; with the extraction but without the re-append the queries are forwarded without the credentials and the check returns 0. Also list `extra_credentials` in the `azureBlobStorageCluster` documentation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ables `AzureStorageParsedArguments::fromAST` removes `extra_credentials(...)` from the engine arguments and never puts it back, and those arguments are what `CREATE` writes into the table metadata. After a restart or DETACH/ATTACH the table lost its `client_id` and `tenant_id` and authenticated with whatever the URL alone implies. Append it back at the end, as the S3 parser does. The one- and two-argument forms ignore `extra_credentials` and still drop it. The test is a unit test because a stateless test cannot reach this: `CREATE` with `extra_credentials` authenticates to check the container, which is refused over plain http, and a full `ATTACH` needs a fixed table UUID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age-partition-strategy-key-value Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age-partition-strategy-key-value Resolve the conflict with #127932, which landed the `extra_credentials` handling of this branch on master: `fromAST` re-appends it through a `SCOPE_EXIT`, and the cluster rewrite sets it aside and appends it back. Take master's version of that code and keep only the key-value `partition_strategy` / `partition_columns_in_data_file` handling on top: - `fromAST`: drop this branch's own re-append of `extra_credentials`, master's `SCOPE_EXIT` already does it (keeping both would append it twice). - cluster rewrite: split the trailing key-value arguments off after master's `extractExtraCredentials`, and insert them back before `extra_credentials`, so the rewritten arguments keep the order positional, key-value, `extra_credentials`. - `gtest_azure_configuration.cpp`: take master's file; its `FromASTKeepsExtraCredentialsInEngineArgs` and `AddStructureAndFormatKeepsExtraCredentials` cover what this branch's `FromASTKeepsExtraCredentialsInTableDefinition` covered. - `TableFunctionObjectStorageCluster.cpp`: take master's file; the `extra_credentials` documentation row is not part of the `partition_strategy` fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After merging master, the `extra_credentials` arms of `05291_azure_blob_storage_partition_strategy_key_value` failed for two reasons that have nothing to do with the key-value arguments: - Since 3b7f7be a user query may use the server's workload identity only with `s3_allow_server_credentials_in_user_queries = 1`; without it the initiator answers `ACCESS_DENIED` before rewriting the arguments (05218 enables the setting the same way). - Since #122770 the query log shows `extra_credentials(...)` as '[HIDDEN]', so the old `LIKE '%extra_credentials(client_id%'` oracle matched nothing. Enable the setting for the cluster arms, and make the oracle match the forwarded arguments ending in `partition_strategy = 'none', '[HIDDEN]')`: the key-value arguments first, then `extra_credentials`. Swapping that order in the rewrite turns the result from 3 into 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`fromAST` evaluated the positional engine arguments in place but kept the
key-value `partition_strategy` and `partition_columns_in_data_file`
arguments as written, so the stored table definition kept the expression
and `ATTACH` evaluated it again in another context. A table created with
`partition_strategy = if(getSetting('use_hive_partitioning'), 'hive', 'none')`
under `use_hive_partitioning = 1` lost its hive strategy when attached under
`use_hive_partitioning = 0`. Replace each key-value value with its literal,
as for the positional arguments. The S3 engine also keeps key-value
arguments unevaluated; it is not changed here.
05291: add a DETACH/ATTACH arm that changes the setting in between. Drop
the query_log oracle of the `extra_credentials` cluster arms: the initiator
fails before its replica logs the forwarded query, so `SYSTEM FLUSH LOGS`
could miss it (2 of 100 randomized runs). A gtest now checks that the
cluster rewrite keeps the key-value arguments and then `extra_credentials`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion-strategy-key-value Fix loading `AzureBlobStorage` tables whose engine arguments end with `partition_strategy = 'none'`
26.10 lacks the Azure key-value / extra_credentials argument handling; keep the incoming additions (matches a from-scratch cherry-pick onto 26.10).
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.
Original pull-request #122707
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job