From 522b5b030217c81a52162db8cfbb8a8dd1fa20b2 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Wed, 20 May 2015 15:43:30 -0400 Subject: [PATCH] sstable: allow for empty key_views Signed-off-by: Glauber Costa --- sstables/key.hh | 3 +++ sstables/partition.cc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sstables/key.hh b/sstables/key.hh index 032a75d329db..856dfcdf3514 100644 --- a/sstables/key.hh +++ b/sstables/key.hh @@ -16,12 +16,15 @@ class key_view { bytes_view _bytes; public: key_view(bytes_view b) : _bytes(b) {} + key_view() : _bytes() {} std::vector explode(const schema& s) const; bool operator==(const key_view& k) const { return k._bytes == _bytes; } bool operator!=(const key_view& k) const { return !(k == *this); } + bool empty() { return _bytes.empty(); } + explicit operator bytes_view() const { return _bytes; } diff --git a/sstables/partition.cc b/sstables/partition.cc index 6048c06ed90e..ab9f534eebed 100644 --- a/sstables/partition.cc +++ b/sstables/partition.cc @@ -224,7 +224,7 @@ class mp_row_consumer : public row_consumer { mp_row_consumer(const key& key, const schema_ptr _schema) : _schema(_schema) - , _key(key) + , _key(key_view(key)) , mut(partition_key::from_exploded(*_schema, key.explode(*_schema)), _schema) { }