-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate ByteSlice into bliss (#48)
ByteSlice is now integrated into Bliss, with two parameters to pass: number of rows and number of bits per row.
- Loading branch information
1 parent
0336039
commit a60328c
Showing
5 changed files
with
89 additions
and
2 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
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
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,56 @@ | ||
#ifndef BLISS_BENCH_BYTESLICE | ||
#define BLISS_BENCH_BYTESLICE | ||
|
||
#include <vector> | ||
|
||
#include "bliss/bliss_index.h" | ||
#include "src/byteslice.h" | ||
#include <string> | ||
|
||
namespace bliss { | ||
|
||
template <typename KEY_TYPE, typename VALUE_TYPE> | ||
class BlissByteSliceIndex : public BlissIndex<KEY_TYPE, VALUE_TYPE> { | ||
public: | ||
BlissByteSliceIndex(int numrows = 1000000, int numbits = 32) { | ||
byteslice_ = new byteslice::ByteSlice(numrows, numbits); | ||
}; | ||
|
||
~BlissByteSliceIndex() { | ||
delete byteslice_; | ||
} | ||
|
||
void bulkload( | ||
std::vector<std::pair<KEY_TYPE, VALUE_TYPE>> values) override { | ||
int i = 0; | ||
for(auto x: values) { | ||
byteslice_->setTuple(i, static_cast<unsigned long long>(x.second)); | ||
} | ||
} | ||
|
||
|
||
bool get(VALUE_TYPE start, VALUE_TYPE end) { | ||
uint32_t * result = byteslice_->query(static_cast<unsigned long long>(start), static_cast<unsigned long long>(end)); | ||
bool check_ = result != nullptr; | ||
if(check_) delete result; | ||
return check_; | ||
} | ||
|
||
bool get(KEY_TYPE key) override { | ||
std::runtime_error("ByteSlice does not support get(key, value)."); | ||
return false; | ||
} | ||
|
||
void put(KEY_TYPE key, VALUE_TYPE value) { | ||
std::runtime_error("ByteSlice does not support put(key, value)."); | ||
return; | ||
} | ||
|
||
void end_routine() override {} | ||
private: | ||
byteslice::ByteSlice *byteslice_; | ||
}; | ||
|
||
} // namespace bliss | ||
|
||
#endif // !BLISS_BENCH_BTREE |
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
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