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

Sprint3 #3

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Sprint3 #3

wants to merge 32 commits into from

Conversation

j-beyer
Copy link
Owner

@j-beyer j-beyer commented Dec 3, 2017

No description provided.

j-beyer and others added 30 commits November 20, 2017 21:44
Fixing template instantiation
for (auto col_id = ColumnID{0}; col_id < deref_table->col_count(); ++col_id) {
// add column definition
// TODO(team): is there a nicer way to combine add_column_definition and emplace_chunk ?
result_table->add_column(deref_table->column_name(col_id), deref_table->column_type(col_id));

Choose a reason for hiding this comment

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

Maybe you could have used add_column_definition.
Is there a reason why you don't use this method?

Copy link
Owner Author

@j-beyer j-beyer Dec 12, 2017

Choose a reason for hiding this comment

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

In one of the earlier sprints, we added an is_instantiated flag for each column definition, which is only set to true if we call add_column, but not if we only add_column_definition - thus, we used add_column in this case, but weren't quite happy with that

template <typename T>
void TableScan::TableScanImpl<T>::_create_pos_list(bool is_reference) {
// first we need to know which data type we are targeting
T search_value = type_cast<T>(_search_value);

Choose a reason for hiding this comment

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

search_value could be const

* which, in turn, can only be ValueColumns or DictionaryColumns again
*/
auto value_column = std::dynamic_pointer_cast<ValueColumn<T>>(base_column);
if (value_column != nullptr) {

Choose a reason for hiding this comment

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

if(value_column) should be sufficient

}

auto dictionary_column = std::dynamic_pointer_cast<DictionaryColumn<T>>(base_column);
if (dictionary_column != nullptr) {

Choose a reason for hiding this comment

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

same here =)

@@ -126,8 +126,10 @@ void Table::_validate_existing_definition(const std::string& name, const std::st
Assert(!_is_instantiated.at(pos), "A column with the given name was already added!");
}

void emplace_chunk(Chunk chunk) {
// Implementation goes here
void Table::emplace_chunk(Chunk chunk) {

Choose a reason for hiding this comment

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

The expected behaviour should be following:
Adds a chunk to the table. If the first chunk is empty, it is replaced. <-- table.hpp

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point - we missed that.

Copy link

@b-feldmann b-feldmann left a comment

Choose a reason for hiding this comment

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

Nice implementation :)

The end of table_scan_impl could have more comments.


protected:
void _create_pos_list(bool is_reference);
template <typename C>
Copy link
Contributor

Choose a reason for hiding this comment

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

You could add empty lines when you have multiline method definitions, especially when they also have template.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, you should add comments for your methods.

auto chunk = Chunk{};

// Fill the chunk with reference columns to mirror the original relation
for (auto col_id = ColumnID{0}; col_id < deref_table->col_count(); ++col_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Writing column_id wouldn't hurt.


// This function implements the actual scanning
template <typename T>
void TableScan::TableScanImpl<T>::_create_pos_list(bool is_reference) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method does way more than creating a pos list, so it should be named appropriately. Also, a create method that does not return anything is unexpected.

* only include values in the result that were also referenced from the previous operation
* we basically scan the entire table again and only include values that are also included
* in the input PosList
* this might not be very efficient, but increases readability for now
Copy link
Contributor

Choose a reason for hiding this comment

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

"not very efficient" is an understatement... ;)

}

template <typename T>
template <typename C>
Copy link
Contributor

Choose a reason for hiding this comment

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

What does C stand for? Why is it needed?

switch (_scan_type) {
case ScanType::OpLessThan:
case ScanType::OpLessThanEquals:
if (first > search_value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

return first > search_value would save the reader from having to read until the end of the method to find out what happens.

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.

3 participants