8000 [DYOD] Team 2 - Sprint 4 by ClFeSc · Pull Request #2579 · hyrise/hyrise · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[DYOD] Team 2 - Sprint 4 #2579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/test/lib/logical_query_plan/dummy_table_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ TEST_F(DummyTableNodeTest, NoUniqueColumnCombinations) {
EXPECT_TRUE(_dummy_table_node->unique_column_combinations().empty());
}

TEST_F(DummyTableNodeTest, IsColumnNullable) {
EXPECT_THROW(_dummy_table_node->is_column_nullable(ColumnID{0}), std::logic_error);
}

} // namespace hyrise
51 changes: 51 additions & 0 deletions src/test/lib/storage/table_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "resolve_type.hpp"
#include "storage/table.hpp"
#include "utils/load_table.hpp"
#include "storage/index/partial_hash/partial_hash_index.hpp"

namespace hyrise {

Expand Down Expand Up @@ -284,4 +285,54 @@ TEST_F(StorageTableTest, StableChunks) {
EXPECT_EQ((*(*first_chunk)->get_segment(ColumnID{0}))[ChunkOffset{0}], AllTypeVariant{100});
}

TEST_F(StorageTableTest, LastChunkOfReferenceTable) {
const auto reference_table = std::make_shared<Table>(column_definitions, TableType::References);
const auto posList = std::make_shared<RowIDPosList>(1);
const auto segment_int = std::make_shared<ReferenceSegment>(t, ColumnID{0}, posList);
const auto segment_string = std::make_shared<ReferenceSegment>(t, ColumnID{1}, posList);
const auto segments = Segments{segment_int, segment_string};
const auto second_segment = Segments{segment_int, segment_string};
reference_table->append_chunk(segments);
reference_table->append_chunk(second_segment);
const auto last_chunk = reference_table->get_chunk(ChunkID{1});
EXPECT_EQ(reference_table->last_chunk(), last_chunk);
}

TEST_F(StorageTableTest, CreatePartialHashIndex) {
auto hash_index = t->get_table_indexes();
EXPECT_TRUE(hash_index.empty());
const auto world_string = pmr_string{"World"};
const auto hello_string = pmr_string{"Hello"};
t->append({4, hello_string});
t->append({3, world_string});
t->append({6, hello_string});
t->append({7, "!"});
t->append({8, "?"});
t->create_partial_hash_index(ColumnID{1}, {ChunkID{0}, ChunkID{1}});
hash_index = t->get_table_indexes();
ASSERT_EQ(hash_index.size(), 1);
const auto created_hash_index = hash_index[0];
EXPECT_EQ(created_hash_index->get_indexed_column_id(), ColumnID{1});

auto access_range_equals_with_iterators_hello = [](auto begin, const auto end) {
EXPECT_EQ(std::distance(begin, end), 2);

EXPECT_EQ(*begin, RowID(ChunkID{0}, ChunkOffset{0}));
++begin;
EXPECT_EQ(*begin, RowID(ChunkID{1}, ChunkOffset{0}));
};
created_hash_index->range_equals_with_iterators(access_range_equals_with_iterators_hello, hello_string);

auto access_range_equals_with_iterators_world = [](const auto begin, const auto end) {
EXPECT_EQ(std::distance(begin, end), 1);

EXPECT_EQ(*begin, RowID(ChunkID{0}, ChunkOffset{1}));
};
created_hash_index->range_equals_with_iterators(access_range_equals_with_iterators_world, world_string);
}

TEST_F(StorageTableTest, CreatePartialHashIndexOnEmptyChunks) {
EXPECT_THROW(t->create_partial_hash_index(ColumnID{0}, {}), std::logic_error);
}

} // namespace hyrise
0