Skip to content
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

Sprint1 #1

Merged
merged 39 commits into from
May 3, 2021
Merged

Sprint1 #1

merged 39 commits into from
May 3, 2021

Conversation

ShirleyNekoDev
Copy link
Collaborator

No description provided.

@ShirleyNekoDev
Copy link
Collaborator Author

TODO: fix todos, do lint, do format

Copy link
Owner

@hig-dev hig-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

@simonstadlinger simonstadlinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, very thoughtful implementation. Good job.
Greetings to the allgäu!

src/lib/storage/value_segment.cpp Outdated Show resolved Hide resolved
src/lib/storage/chunk.cpp Outdated Show resolved Hide resolved
src/lib/storage/chunk.cpp Outdated Show resolved Hide resolved
src/lib/storage/chunk.cpp Outdated Show resolved Hide resolved
src/lib/storage/table.cpp Show resolved Hide resolved
src/lib/storage/table.cpp Outdated Show resolved Hide resolved
src/lib/storage/table.cpp Outdated Show resolved Hide resolved
src/lib/storage/table.cpp Outdated Show resolved Hide resolved
src/lib/storage/table.cpp Outdated Show resolved Hide resolved
src/lib/storage/table.cpp Outdated Show resolved Hide resolved
hig-dev and others added 2 commits May 3, 2021 22:17
Co-authored-by: simonstadlinger <33035544+simonstadlinger@users.noreply.github.com>
@hig-dev hig-dev merged commit c440f15 into master May 3, 2021
void Chunk::add_segment(std::shared_ptr<BaseSegment> segment) {
// Implementation goes here
}
void Chunk::add_segment(std::shared_ptr<BaseSegment> segment) { _columns.emplace_back(segment); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a segment is added to a chunk that already contains values?

src/lib/storage/chunk.cpp Outdated Show resolved Hide resolved
src/lib/storage/chunk.cpp Outdated Show resolved Hide resolved
Comment on lines +24 to +25
const auto dropped_table_count = _tables.erase(name);
Assert(dropped_table_count == 1, "Table could not be removed because it was not found.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!


std::vector<std::string> StorageManager::table_names() const {
throw std::runtime_error("Implement StorageManager::table_names");
auto table_names = std::vector<std::string>{};
table_names.reserve(_tables.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Comment on lines 45 to 46
DebugAssert(_chunks.back()->size() != _target_chunk_size,
"Cannot emplace chunk because current last chunk is not full.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this invariant specified?

Comment on lines 63 to 65
if (find_result_iter == _columns.end()) {
throw std::invalid_argument("Column name does not exists.");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be an assert.


void Table::_append_column_to_chunks(const std::string& type) {
DebugAssert(row_count() == 0, "Cannot append new columns to already existing chunks.");
for (const auto& chunk : _chunks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If row_count() == 0 there should be only one chunk.


// Returns a list of all column names.
const std::vector<std::string>& column_names() const;
const std::vector<std::string> column_names() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public interface was not supposed to be changed. But we can see that you had to do it due to your self-defined Column data type.

EXPECT_THROW(t.column_id_by_name("no_column_name"), std::exception);
}

TEST_F(StorageTableTest, GetChunkSize) { EXPECT_EQ(t.target_chunk_size(), 2u); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, the test's name is suboptimal.

@@ -10,38 +10,47 @@
namespace opossum {

StorageManager& StorageManager::get() {
return *(new StorageManager());
// A really hacky fix to get the tests to run - replace this with your implementation
static StorageManager _instance;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only use a leading underscore for private/protected members/methods but not for local variables, see CONTRIBUTING.md.

std::vector<std::unique_ptr<Chunk>> _chunks;
std::vector<Column> _columns;

// TODO(hig): If we need this more often, consider to move this to BaseSegment or ValueSegment
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODOs should be done in a submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants