Skip to content

Fix geo columns reading in Arrow reader - #103032

Merged
alexey-milovidov merged 3 commits into
masterfrom
fix-geo-parquet-2
May 21, 2026
Merged

alexey-milovidov merged 3 commits into
masterfrom
fix-geo-parquet-2

Conversation

@Avogar

@Avogar Avogar commented Apr 17, 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 nullable inference for geo columns in Arrow-based Parquet reader. Closes #101845

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.1.921

@clickhouse-gh

clickhouse-gh Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [14122ed]

Summary: ✅


AI Review

Summary

This PR fixes geospatial metadata handling in the Arrow IPC reader path by using schema metadata (instead of footer metadata / nullptr) and by respecting input_format_parquet_allow_geoparquet_parser when building geo metadata maps in ArrowColumnToCHColumn. The new regression test exercises the Arrow IPC path directly (including parser enabled/disabled behavior and NULL handling). I did not find unresolved contract violations in the current code.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 17, 2026
@nihalzp nihalzp self-assigned this May 12, 2026
@nihalzp

nihalzp commented May 17, 2026

Copy link
Copy Markdown
Member

From src/Core/FormatFactorySettings.h line 1588,

    MAKE_OBSOLETE(M, Bool, input_format_parquet_use_native_reader_v3, true) \

The setting is obsolete. That means the code change is not exercised by the test file content. For sanity, I reran the test on master (that does not have this patch), it passed.

@nihalzp

nihalzp commented May 17, 2026

Copy link
Copy Markdown
Member

The issue #101845 is correct; it was created 6 April. And, the setting was made obsolete in #100949 late April, bypassing the buggy code permanently for this scenario.

@Avogar

Avogar commented May 19, 2026

Copy link
Copy Markdown
Member Author

Good, than we can close it

@Avogar Avogar closed this May 19, 2026
@Avogar Avogar reopened this May 20, 2026
@Avogar

Avogar commented May 20, 2026

Copy link
Copy Markdown
Member Author

Hmm, it may be still relevant for Arrow format, need to check and add a test

…:ClickHouse/ClickHouse into fix-geo-parquet-2
@Avogar Avogar changed the title Fix nullable inference for geo columns in Arrow-based Parquet reader Fix geo columns reading in Arrow reader May 20, 2026
Arrow IPC stores schema-level metadata in `schema->metadata()`, not in
`file_reader->metadata()` (which returns IPC footer custom metadata).
The Arrow reader was passing the wrong metadata to `ArrowColumnToCHColumn`,
so the `geo` key was never found and geoparquet parsing never activated
for Arrow IPC files.

Fix `ArrowBlockInputFormat` to pass `schema->metadata()` in both the
schema inference and data reading paths.

Also fix `readColumnWithGeoData` to use `buffer->data()` instead of
`buffer->mutable_data()`, since Arrow IPC buffers are immutable and
the data is only read, not modified.

Rewrite the test to use Arrow IPC format instead of the removed
Arrow-based Parquet reader path.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.50% 76.50% +0.00%

Changed lines: 100.00% (29/29) · Uncovered code

Full report · Diff report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue May 21, 2026
Merged via the queue into master with commit 4cc9699 May 21, 2026
489 of 491 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-geo-parquet-2 branch May 21, 2026 02:31
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 21, 2026
pull Bot pushed a commit to sowelswl/ClickHouse that referenced this pull request May 25, 2026
The test was failing on master (and many open PRs) under sanitizer and S3
builds with both `secret_user sees:` and `admin sees:` returning 0 — i.e.
the queued async insert was no longer in `system.asynchronous_inserts` by
the time the user-filter `SELECT` queries ran.

PR ClickHouse#103032 dropped the `no-parallel` tag added in ClickHouse#100233 on the premise
that all unscoped `SYSTEM FLUSH ASYNC INSERT QUEUE` callers were migrated
to the table-scoped variant. The premise holds for the tests that *call*
flush, but this test does not call flush at all — it relies on the
opposite: a pending entry must remain in the queue between `INSERT` and
the three subsequent `SELECT` queries. Any concurrent unscoped flush
drains it, and even without that there is a residual race in slow CI
environments where the entry's visibility through
`system.asynchronous_inserts` can lag the client return.

Re-add `no-parallel` with a comment that captures the real reason (the
test consumes pending state, it does not produce it), disable
`async_insert_use_adaptive_busy_timeout` so the per-query 10-minute
deadline is honored exactly and `max_busy_timeout_exceeded` cannot force
an early flush when the shard has been idle, and poll
`system.asynchronous_inserts` for up to 30 seconds before running the
user-filter checks so the test fails clean on a real visibility bug
instead of racing the queue.

CI history:
https://play.clickhouse.com/play?user=play#V0lUSAogICAgOTAgQVMgaW50ZXJ2YWxfZGF5cwpTRUxFQ1QKICAgIHRvU3RhcnRPZkRheShjaGVja19zdGFydF90aW1lKSBBUyBkYXksCiAgICBjb3VudCgpIEFTIGZhaWx1cmVzLAogICAgZ3JvdXBVbmlxQXJyYXkocHVsbF9yZXF1ZXN0X251bWJlcikgQVMgcHJzLAogICAgYW55KHJlcG9ydF91cmwpIEFTIHJlcG9ydF91cmwKRlJPTSBjaGVja3MKV0hFUkUgKG5vdygpIC0gdG9JbnRlcnZhbERheShpbnRlcnZhbF9kYXlzKSkgPD0gY2hlY2tfc3RhcnRfdGltZQogICAgQU5EIHRlc3RfbmFtZSA9ICcwNDA0M19zeXN0ZW1fYXN5bmNocm9ub3VzX2luc2VydHNfdXNlcl9maWx0ZXInCiAgICBBTkQgdGVzdF9zdGF0dXMgSU4gKCdGQUlMJywgJ0VSUk9SJykKICAgIEFORCAocHVsbF9yZXF1ZXN0X251bWJlciA9IDAgT1IgYmFzZV9yZWYgSU4gKCdtYXN0ZXInKSkKICAgIEFORCB0ZXN0X2NvbnRleHRfcmF3IExJS0UgJyVyZXN1bHQgZGlmZmVycyB3aXRoIHJlZmVyZW5jZSUnCkdST1VQIEJZIGRheQpPUkRFUiBCWSBkYXkgREVTQwo=
DavidHe-2008 pushed a commit to DavidHe-2008/ClickHouse that referenced this pull request Jun 1, 2026
DavidHe-2008 pushed a commit to DavidHe-2008/ClickHouse that referenced this pull request Jun 1, 2026
The test was failing on master (and many open PRs) under sanitizer and S3
builds with both `secret_user sees:` and `admin sees:` returning 0 — i.e.
the queued async insert was no longer in `system.asynchronous_inserts` by
the time the user-filter `SELECT` queries ran.

PR ClickHouse#103032 dropped the `no-parallel` tag added in ClickHouse#100233 on the premise
that all unscoped `SYSTEM FLUSH ASYNC INSERT QUEUE` callers were migrated
to the table-scoped variant. The premise holds for the tests that *call*
flush, but this test does not call flush at all — it relies on the
opposite: a pending entry must remain in the queue between `INSERT` and
the three subsequent `SELECT` queries. Any concurrent unscoped flush
drains it, and even without that there is a residual race in slow CI
environments where the entry's visibility through
`system.asynchronous_inserts` can lag the client return.

Re-add `no-parallel` with a comment that captures the real reason (the
test consumes pending state, it does not produce it), disable
`async_insert_use_adaptive_busy_timeout` so the per-query 10-minute
deadline is honored exactly and `max_busy_timeout_exceeded` cannot force
an early flush when the shard has been idle, and poll
`system.asynchronous_inserts` for up to 30 seconds before running the
user-filter checks so the test fails clean on a real visibility bug
instead of racing the queue.

CI history:
https://play.clickhouse.com/play?user=play#V0lUSAogICAgOTAgQVMgaW50ZXJ2YWxfZGF5cwpTRUxFQ1QKICAgIHRvU3RhcnRPZkRheShjaGVja19zdGFydF90aW1lKSBBUyBkYXksCiAgICBjb3VudCgpIEFTIGZhaWx1cmVzLAogICAgZ3JvdXBVbmlxQXJyYXkocHVsbF9yZXF1ZXN0X251bWJlcikgQVMgcHJzLAogICAgYW55KHJlcG9ydF91cmwpIEFTIHJlcG9ydF91cmwKRlJPTSBjaGVja3MKV0hFUkUgKG5vdygpIC0gdG9JbnRlcnZhbERheShpbnRlcnZhbF9kYXlzKSkgPD0gY2hlY2tfc3RhcnRfdGltZQogICAgQU5EIHRlc3RfbmFtZSA9ICcwNDA0M19zeXN0ZW1fYXN5bmNocm9ub3VzX2luc2VydHNfdXNlcl9maWx0ZXInCiAgICBBTkQgdGVzdF9zdGF0dXMgSU4gKCdGQUlMJywgJ0VSUk9SJykKICAgIEFORCAocHVsbF9yZXF1ZXN0X251bWJlciA9IDAgT1IgYmFzZV9yZWYgSU4gKCdtYXN0ZXInKSkKICAgIEFORCB0ZXN0X2NvbnRleHRfcmF3IExJS0UgJyVyZXN1bHQgZGlmZmVycyB3aXRoIHJlZmVyZW5jZSUnCkdST1VQIEJZIGRheQpPUkRFUiBCWSBkYXkgREVTQwo=
groeneai pushed a commit to groeneai/ClickHouse that referenced this pull request Jun 22, 2026
An `ALTER TABLE ... ADD COLUMN ... ALIAS` (or a `DEFAULT`/`MODIFY` command)
whose expression folds to a value that cannot be cast to the column type used
to be accepted, but then failed when the table was re-attached, which could
block server startup. This was fixed by validating default expressions across
all columns at DDL time (PR ClickHouse#103032).

Add a stateless test that locks in the fix: the broken `ALTER`/`CREATE` is now
rejected up front, the table stays usable after a rejected `ALTER`, and a valid
alias survives `DETACH`/`ATTACH`.

Closes: ClickHouse#59949

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default 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.

Nullable wrapping bypassed for geo columns when allow_geoparquet_parser=false in Arrow-based reader

5 participants