-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add learned index (RadixSpline) Rust bindings (#511)
Add end to end tpch benchmarking code add build script that compiles and links c++ radixspline library add safe rust module for running radixspline Note: may need to manually delete radixspline.o and libradixspline.a from sandbox/qe/RadixSplineLib to force recompilation when changes are made to the C++ radixspline code. --------- Co-authored-by: Geoffrey Yu <[email protected]>
- Loading branch information
1 parent
2070775
commit d9c8ec6
Showing
18 changed files
with
665 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,7 @@ sandbox/qe/.brad_qe_repl_history | |
# BRAD UI. | ||
ui/dist/ | ||
ui/node_modules/ | ||
|
||
*.tmp | ||
*.o | ||
*.a |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "sandbox/qe/RadixSpline"] | ||
path = sandbox/qe/RadixSpline | ||
url = https://github.com/learnedsystems/RadixSpline |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Submodule RadixSpline
added at
ab96aa
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "radixspline.h" | ||
|
||
void* build(const uint64_t* ks, uint64_t size) { | ||
RSData* rs = new RSData; | ||
rs->keys = std::vector<uint64_t>(size); | ||
memcpy(rs->keys.data(), ks, size * sizeof(uint64_t)); | ||
uint64_t min = rs->keys.front(); | ||
uint64_t max = rs->keys.back(); | ||
rs::Builder<uint64_t> rsb(min, max); | ||
for (const auto& key : rs->keys) rsb.AddKey(key); | ||
rs::RadixSpline<uint64_t> rso = rsb.Finalize(); | ||
rs->rspline = rso; | ||
return (void*)rs; | ||
} | ||
|
||
bool lookup(void* ptr, uint64_t key) { | ||
RSData* rs = (RSData*) ptr; | ||
rs::SearchBound bound = rs->rspline.GetSearchBound(key); | ||
auto start = begin(rs->keys) + bound.begin, last = begin(rs->keys) + bound.end; | ||
auto iter = std::lower_bound(start, last, key); | ||
return iter != rs->keys.end() && *iter == key; | ||
} | ||
|
||
void clear(void* ptr) { | ||
RSData* rs = (RSData*) ptr; | ||
delete rs; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "../RadixSpline/include/rs/builder.h" | ||
#include <string.h> | ||
|
||
|
||
struct RSData { | ||
std::vector<uint64_t> keys; | ||
rs::RadixSpline<uint64_t> rspline; | ||
}; | ||
|
||
extern "C" { | ||
|
||
int32_t add(int32_t a, int32_t b); | ||
void* build(const uint64_t* ks, uint64_t size); | ||
|
||
bool lookup(void* ptr, uint64_t key); | ||
|
||
void clear(void* ptr); | ||
} |
Oops, something went wrong.