Skip to content

Fix polaris catalog with azure - #100583

Merged
scanhex12 merged 14 commits into
ClickHouse:masterfrom
scanhex12:fix_iceberg_polaris
Apr 9, 2026
Merged

scanhex12 merged 14 commits into
ClickHouse:masterfrom
scanhex12:fix_iceberg_polaris

Conversation

@scanhex12

@scanhex12 scanhex12 commented Mar 24, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix polaris catalog with azure. Since 25.12 this catalog with azure started to add bucket at the beginning of the path. For example abfss://polaris-polaris@<some_url>.windows.net/polaris-polaris/<other-path> instead of abfss://polaris-polaris@<some_url>.windows.net/<other-path>. This PR cuts bucket in the path

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.708

@clickhouse-gh

clickhouse-gh Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c37c6d7]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_asan_ubsan, flaky check) failure
03582_azure_double_free FAIL cidb
02933_replicated_database_forbid_create_as_select FAIL cidb
03008_azure_plain_rewritable_with_slash FAIL cidb
03008_azure_plain_rewritable_with_slash FAIL cidb
03582_azure_double_free FAIL cidb
Stateless tests (amd_asan_ubsan, flaky check) failure
03008_azure_plain_rewritable_alter_partition FAIL cidb
03008_azure_plain_rewr_data_paths FAIL cidb
03582_azure_double_free FAIL cidb
03779_materialized_view_database_context FAIL cidb
03843_truncate_database_parallel_cancel FAIL cidb
Stateless tests (amd_tsan, flaky check) failure
03310_create_database_with_settings FAIL cidb
03843_truncate_database_parallel_cancel FAIL cidb
03008_azure_plain_rewritable_alter_partition FAIL cidb
03008_azure_plain_rewritable_alter_partition FAIL cidb
03843_truncate_database_parallel_cancel FAIL cidb
Stateless tests (amd_msan, flaky check) failure
03754_database_table_functions FAIL cidb
03361_memory_database_deadlock FAIL cidb
03277_database_backup_database_file_engine FAIL cidb
02933_replicated_database_forbid_create_as_select FAIL cidb
03276_database_backup_merge_tree_table_file_engine FAIL cidb
Stateless tests (amd_debug, flaky check) failure
03008_azure_plain_rewritable FAIL cidb
03754_database_table_functions FAIL cidb
03843_truncate_database_parallel_cancel FAIL cidb
03779_materialized_view_database_context FAIL cidb
03779_materialized_view_database_context FAIL cidb
Stateless tests (amd_msan, WasmEdge, parallel, 1/2) failure
Server died FAIL cidb, issue
MemorySanitizer: use-of-uninitialized-value (STID: 3863-5549) FAIL cidb
Integration tests (amd_asan_ubsan, db disk, old analyzer, 1/6) failure
test_database_iceberg_nessie_catalog/test.py::test_select FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_tables_with_same_location FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_timestamps FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_insert FAIL cidb
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) failure
test_database_iceberg_lakekeeper_catalog/test.py::test_select FAIL cidb
test_database_iceberg_lakekeeper_catalog/test.py::test_tables_with_same_location FAIL cidb
Integration tests (amd_binary, 3/5) failure
test_database_iceberg_lakekeeper_catalog/test.py::test_select FAIL cidb
test_database_iceberg_lakekeeper_catalog/test.py::test_tables_with_same_location FAIL cidb
Integration tests (amd_binary, 4/5) failure
test_database_iceberg_nessie_catalog/test.py::test_select FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_tables_with_same_location FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_timestamps FAIL cidb
test_database_iceberg_nessie_catalog/test.py::test_insert FAIL cidb

AI Review

Summary

This PR adds Polaris-style ABFSS path normalization for DataLake and wires it through DatabaseDataLake settings and TableMetadata URL/metadata path handling, with broad new tests. High-level verdict: the core fix direction is good, but defaulting polaris_style_paths to enabled introduces a backward-compatibility risk for non-Polaris layouts where the first real directory equals the container name.

Findings

⚠️ Majors

  • [src/Databases/DataLake/DatabaseDataLakeSettings.cpp:47] polaris_style_paths is introduced with default true, which changes behavior on upgrade for all ABFSS+endpoint users. Legitimate layouts like abfss://c@account/c/... can be rewritten to .../c/... instead of .../c/c/... unless users explicitly disable it. This is a compatibility regression risk for existing deployments.
    • Suggested fix: set default to false, or enable Polaris-style normalization only for known Polaris catalog types.
Tests
  • ⚠️ Add an integration-level regression test that uses default settings (without explicitly setting polaris_style_paths) and verifies non-Polaris ABFSS paths with container-named first directory are not rewritten unexpectedly during URL construction and metadata resolution.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ⚠️ New setting changes behavior by default for existing ABFSS layouts; old behavior is restorable but not the default after upgrade.
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ⚠️ Default-on rollout can affect non-Polaris users unexpectedly.
Compilation time ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Make polaris_style_paths default conservative (false) or scope the normalization to Polaris-specific flows.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 24, 2026
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
@scanhex12 scanhex12 added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Mar 24, 2026
@arsenmuk arsenmuk self-assigned this Apr 1, 2026
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
Comment thread src/Databases/DataLake/ICatalog.h Resolved
@scanhex12
scanhex12 requested a review from arsenmuk April 2, 2026 13:32
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
strip_container(data_location);

if (!endpoint.empty() && metadata_location.starts_with(azure_host_prefix))
metadata_location = "/" + bucket + "/" + metadata_location.substr(azure_host_prefix.size());

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.

getMetadataLocation can still return a non-relative path when endpoint has a trailing slash (e.g. https://account.dfs.core.windows.net/).

Concrete trace:

  • data_location = getLocation() -> https://account.dfs.core.windows.net/mycontainer/actual/path/
  • stripping by endpoint (with trailing slash) produces data_location = "mycontainer/actual/path/" (no leading /)
  • this branch converts metadata_location to "/mycontainer/actual/path/..." (with leading /)
  • starts_with(data_location) then fails, so the function returns a host-qualified/non-relative path instead of metadata/v1.metadata.json.

Please normalize leading-slash handling consistently for both strings (or normalize endpoint once and always strip to the same shape).

@scanhex12
scanhex12 enabled auto-merge April 8, 2026 10:07
@scanhex12
scanhex12 disabled auto-merge April 8, 2026 10:07

@arsenmuk arsenmuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also there a typo in the description of PR: to add bucket at the begging of the path
begging -> beginning

Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
@scanhex12
scanhex12 requested a review from arsenmuk April 8, 2026 13:17
This was referenced Apr 9, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

7 participants