Repository navigation
Allow zero-size string types |S0 and <U0 in Npy format - #101179
Merged
Algunenano merged 1 commit intoApr 2, 2026
Merged
Conversation
`np.ndarray(shape=(3,), dtype='|S0')` produces a valid `.npy` file with zero-length string elements and zero data bytes. The blanket rejection of `element_size == 0` was incorrect for these types. Guard the overflow division by `element_size` instead of rejecting zero outright. Also fix `readRow` to use a row counter instead of relying solely on `eof()` — for zero-size elements the data section is empty, so EOF is reached immediately despite rows remaining. Fixes ClickHouse#101133 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [31ea671] Summary: ❌
AI ReviewSummaryThis PR updates ClickHouse Rules
Final VerdictStatus: ✅ Approve |
Contributor
LLVM Coverage Report
Changed lines: 78.95% (15/19) · Uncovered code |
yariks5s
approved these changes
Apr 2, 2026
Merged
via the queue into
ClickHouse:master
with commit Apr 2, 2026
990b6a7
156 of 160 checks passed
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.
Follow-up to #100625. The blanket
element_size == 0rejection was incorrect:np.ndarray(shape=(3,), dtype='|S0')produces a valid.npyfile withzero-length string elements and zero data bytes, and NumPy loads it back fine.
Two fixes:
element_size == 0rejection; guard the overflow division instead.readRowto use a row counter instead of relying solely oneof().For zero-size elements the data section is empty, so EOF is reached
immediately despite rows remaining. This caused
SELECT count()(whichuses
countRowsfrom shape metadata) andSELECT *(which usesreadRow)to disagree.
Closes #101133
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog — the regression was introduced in #100625 which has not been included in any release.
Documentation entry for user-facing changes
Version info
26.4.1.521