feat(bindings): span_hash / span_hash_extended for all span types#15
Merged
Conversation
Adds the two MEOS hash scalars for intspan/bigintspan/floatspan/
datespan/tstzspan:
- span_hash(<span>) -> UINTEGER (MEOS uint32 span_hash)
- span_hash_extended(<span>, BIGINT seed) -> UBIGINT (MEOS uint64
span_hash_extended; seed cast to uint64)
Mirrors set_hash / set_hash_extended landed in the corresponding set
PR. Implementation copies the blob into a malloc'd Span, calls MEOS,
frees. Registered in the per-span-type loop in src/temporal/span.cpp
next to lower / upper / lowerInc / upperInc.
Smoke test:
SELECT span_hash(intspan '[1,2]');
-> 2065175488 (UINTEGER)
SELECT span_hash_extended(tstzspan '[2000-01-01,2000-01-02]', 1);
-> 13017976434127639577 (UBIGINT)
Full suite passes (747 assertions, 13 test cases).
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.
Summary
Adds the two MEOS hash scalars for all five span types (intspan/bigintspan/floatspan/datespan/tstzspan):
span_hash(<span>) -> UINTEGER(MEOSuint32 span_hash)span_hash_extended(<span>, BIGINT seed) -> UBIGINT(MEOSuint64 span_hash_extended; seed cast touint64)Mirrors
set_hash/set_hash_extendedfrom the corresponding set PR. Implementation copies the blob into a malloc'dSpan, calls MEOS, frees. Registered in the per-span-type loop insrc/temporal/span.cppnext tolower/upper/lowerInc/upperInc.Smoke test
Test plan
make releasethenTZ=UTC ./build/release/test/unittest "<proj>/test/*"— full suite passes.Activates the
span_hashskip block intest/sql/parity/003_span.test(open in PR #13) once both land.