Skip to content

Fix LOGICAL_ERROR in schema inference for formats without schema reader - #98373

Merged
alexey-milovidov merged 3 commits into
masterfrom
fix-schema-inference-logical-error
Mar 2, 2026
Merged

alexey-milovidov merged 3 commits into
masterfrom
fix-schema-inference-logical-error

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 1, 2026 •

Copy link
Copy Markdown
Member

Summary

When file('') is used and the format is auto-detected from a filename extension (e.g. .capnp → CapnProto), but all matched files are empty, the code in readSchemaFromFormatImpl skips the schema reader check via the EOF continue path and reaches the post-loop getSchemaReader call which throws LOGICAL_ERROR for formats that only have an external schema reader (like CapnProto, Protobuf).

In debug/ASan builds with abort_on_logical_error, this causes SIGABRT and crashes the server.

A previous fix (b089160, #66888) added a check inside the while loop but missed the post-loop code path at line 447.

The fix adds the same checkIfFormatHasSchemaReader guard before the post-loop getSchemaReader call.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98346&sha=9d3c3b9449238c3908fc7a5c355f084920261723&name_0=PR&name_1=Stateless%20tests%20%28arm_asan%2C%20azure%2C%20parallel%29
#98346

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

…chema reader

When `file('')` is used and the format is auto-detected from a filename
extension (e.g. `.capnp` → CapnProto), but all matched files are empty,
the code at `readSchemaFromFormatImpl` skips the schema reader check
(line 244) via the EOF `continue` path and reaches the post-loop
`getSchemaReader` call (line 447) which throws `LOGICAL_ERROR` for
formats that only have an external schema reader (like CapnProto).

In debug/ASan builds with `abort_on_logical_error`, this causes SIGABRT.

The previous fix (b089160, #66888) added the check inside the while
loop but missed this post-loop code path.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98346&sha=9d3c3b9449238c3908fc7a5c355f084920261723&name_0=PR&name_1=Stateless%20tests%20%28arm_asan%2C%20azure%2C%20parallel%29

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

clickhouse-gh Bot commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b6dcfc5]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 1, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Mar 2, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 2, 2026
Merged via the queue into master with commit 1e4fad6 Mar 2, 2026
144 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-schema-inference-logical-error branch March 2, 2026 03:32
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci 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.

2 participants