Fix for Value::String to Value::Fixed resolution ignoring the size from the schema.#542
Open
KitFieldhouse wants to merge 6 commits intoapache:mainfrom
Open
Fix for Value::String to Value::Fixed resolution ignoring the size from the schema.#542KitFieldhouse wants to merge 6 commits intoapache:mainfrom
Value::String to Value::Fixed resolution ignoring the size from the schema.#542KitFieldhouse wants to merge 6 commits intoapache:mainfrom
Conversation
…ts adding padding if needed
martin-g
reviewed
May 5, 2026
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
martin-g
reviewed
May 5, 2026
| Err(Details::CompareFixedSizes { size, n: s.len() }.into()) | ||
| } else { | ||
| let mut bytes = s.into_bytes(); | ||
| bytes.resize(size, 0); |
Member
There was a problem hiding this comment.
I am not sure the padding applied here is the correct thing to do.
There is no such padding for Bytes->Fixed below. An exact match of the length with the size is required.
I think the same should be done here too. Otherwise the reader of the fixed data will have do handle the padding somehow.
Author
There was a problem hiding this comment.
Sounds good, I agree with that logic.
| r#""a""#, | ||
| Value::Fixed(1, vec![97]), | ||
| Value::Fixed(2, vec![97, 0]), | ||
| ), // ASCII 'a' => one byte |
Member
There was a problem hiding this comment.
The comment is outdated here but IMO the padding should be removed. See above.
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.
Hey all,
I noticed that the method
resolve_fixedwith aValue::Stringwill ignore thesizeof theSchema::Fixedand will simply accept whatever sized string is provided, even if its actually too long for the provided fixed.This fix modifies
resolve_fixedso that it checks the size of the string and rejects if its too long for theSchema::Fixed. In addition, if too short of a string is supplied, it is zero padded to the required length.