Conversation
…hen queries keys in an index
…uted if the log is within the log level
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.
Resolves #17
Resolved this issue by transforming the value before encoding it
For
#gt([a, b])we apply the functionget_next_value(), that was added in the src/CandidMod/lib.mo file in this CR, to the last composite field so the bound becomes#eq([a, next(b)]). Because of the nature of composite keys,[a, next(b)]will always be greater than[a, b].If
bwas#Nat(7)next(b)would be#Nat(8).If it were
#Blob([12, 32, 45]), thenext(b)result would be#Blob([12, 32, 45, 1]). Because blobs are null terminated (ends with a 0) we add1instead of a zero at the end to prevent matching on blob values that are equal to the initial value.For
#lt([a, b])we apply the functionget_prev_value(), that was also added in the src/CandidMod/lib.mo file, to the last composite field so the bound becomes#eq([a, prev(b)]).Here, if
bwere#Nat(7)the result of the prev function would be#Nat(6).However, there is some nuance to take note of is
bwere a blob of example#Blob([12, 32, 45]).At first glance it seems like
#Blob([12, 32, 44])is the next smallest value, but we need to consider the lexicographical ordering of the bytes.If we compared
#Blob([12, 32, 44, 5])we will notice that it is less thanbbut greater thanprev(b).If we take the lexicographical ordering into account, the next smallest value is
#Blob([12, 32, 44, 44, 44, 44, 44, 44, 44, ...])with thelast byte - 1repeated to infinity. For this implementation we think it is enough to repeat the character 30 times (we picked this number arbitrarily).There is one more edge case to consider. If the last byte in the blob was zero, we need pop the zero and return the remaining bytes.