Skip to content

Commit

Permalink
Add comments and fix iterator tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-PLACET committed Apr 4, 2024
1 parent 64815c5 commit 9a6ab2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion include/sparrow/dictionary_encoded_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ namespace sparrow
using sub_layout = mpl::constify_t<SL, is_const>;
using sub_layout_reference = sub_layout&;

// `dictionary_value_iterator` needs to be default constructible
// to satisfy `dictionary_encoded_layout::const_value_range`'s
// constraints.
dictionary_value_iterator() noexcept = default;
dictionary_value_iterator(index_iterator index_it, sub_layout_reference sub_layout_reference);

Expand Down Expand Up @@ -114,7 +117,7 @@ namespace sparrow
using const_reference = const_reference_proxy<SL>;
using size_type = std::size_t;
using indexes_layout = fixed_size_layout<IT>;
using iterator_tag = std::contiguous_iterator_tag;
using iterator_tag = std::random_access_iterator_tag;

/**
* These types have to be public to be accessible when
Expand All @@ -129,6 +132,8 @@ namespace sparrow
using data_iterator = data_type*;
using const_data_iterator = const data_type*;

// TODO: implement the iterator once #35 is merged
// using iterator = layout_iterator<self_type, false>;
using const_iterator = layout_iterator<self_type, true>;

using bitmap_iterator = indexes_layout::bitmap_iterator;
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(SPARROW_TESTS_SOURCES
test_layout.cpp
test_variable_size_binary_layout.cpp
test_dictionary_encoded_layout.cpp
test_memory.cpp
)
set(test_target "test_sparrow_lib")
add_executable(${test_target} ${SPARROW_TESTS_SOURCES})
Expand Down
5 changes: 1 addition & 4 deletions test/test_dictionary_encoded_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using data_type_t = uint8_t;
constexpr size_t element_count = 10;
static const std::array<data_type_t, element_count> indexes {1,0,3, 0,1,2,3, 2, 4,2};
static const std::array<data_type_t, element_count> indexes {1, 0,3, 0, 1, 2, 3, 2, 4, 2};

namespace sparrow
{
Expand Down Expand Up @@ -92,13 +92,10 @@ namespace sparrow

TEST_CASE_FIXTURE(dictionary_encoded_fixture, "constructors")
{
CHECK(m_data.dictionary.use_count() == 1);
CHECK(m_data.buffers.size() == 1);
const layout_type l_copy(m_data);
CHECK(m_data.dictionary.use_count() == 2);
CHECK(m_data.buffers.size() == 1);
const layout_type l_move(std::move(m_data));
CHECK(m_data.dictionary.use_count() == 0);
CHECK(m_data.buffers.size() == 0);
}

Expand Down

0 comments on commit 9a6ab2b

Please sign in to comment.