Conversation
* add clang-format clang-tidy * add clang-format clang-tidy * fixing gitignore * file reader and writer added * scheme reader * encoder added * batch bug fix * simple decoder * clean up * some fixes
…ame resolving and some clean up
| return std::visit( | ||
| [](const auto& left, const auto& right) -> bool { |
There was a problem hiding this comment.
Лучше делать std::visit по одному параметру и в теле делать std::get_if. Иначе очень много кода генерируется и бинарь раздувается
| if (ra_rg < num_row_groups_) { | ||
| for (size_t col : columns_) { | ||
| const auto& meta = batch_meta_[ra_rg * cols + col]; | ||
| readahead(reader_.Fd(), meta.offset, meta.size); |
There was a problem hiding this comment.
Хм, а не получается ли тут так, что у тебя эта штуковина зовется для 4-й, 5-й и так далее групп, но не зовется для 1-й, 2-й и 3-й?
There was a problem hiding this comment.
А еще хорошо бы это спрятать в самого reader_
| if (!col_descs[k].is_str) { | ||
| size_t cur = buf.size(); | ||
| buf.resize(cur + sizeof(int64_t)); | ||
| __builtin_memcpy(buf.data() + cur, &ptrs[k].ints[i], sizeof(int64_t)); |
| // AggregateOp | ||
|
|
||
| inline void AggregateOp::UpdateSlot(AggSlot& slot, EngineBatch& batch, RowIndex i, bool only_count_all) { | ||
| if (has_count_all_) { slot.count++; } |
There was a problem hiding this comment.
МБ это лучше вытаскивать в отдельный оператор, чтобы тут не было if-а на каждую строчку?
| std::vector<char> prefetch_key_buf; | ||
| std::vector<size_t> prefetch_hashes(n); | ||
| std::vector<std::pair<size_t, size_t>> prefetch_key_spans(n); |
| for (char c : str_val) { | ||
| if (c != '%') { stripped.push_back(c); } | ||
| } |
There was a problem hiding this comment.
Кажется, для запроса %ab%cd%ef% тут будет ошибка (ты будешь искать подстроку bc, например)?
| class IntConstNE : public FilterPredicate { | ||
| public: | ||
| IntConstNE(size_t id_a, int64_t const_b) : id_a_(id_a), const_b_(const_b) {} | ||
| bool Check(const EngineBatch& batch, RowIndex i) override { | ||
| return std::get<std::vector<int64_t>>(batch.columns[id_a_])[i] != const_b_; | ||
| } | ||
| private: | ||
| size_t id_a_; | ||
| int64_t const_b_; | ||
| }; |
There was a problem hiding this comment.
Можно было сделать компаратор шаблонным, разово реализовать, а остальное выразить через using
| class StrConstNE : public FilterPredicate { | ||
| public: |
There was a problem hiding this comment.
Смущает, что везде под строки отдельный класс заводится. Будто бы тоже как-то шаблонами можно это обойти
| return result; | ||
| } | ||
|
|
||
| }; // namespace column_engine No newline at end of file |
There was a problem hiding this comment.
В конце неймспейса не нужны ;, а еще в конце файла нужны строки. Эх, вот бы существовала какая-нибудь тулза, следящая за форматированием
| if (rle) { | ||
| uint64_t val_last = 0; | ||
| uint8_t cnt = 0; | ||
| for (size_t i = 0; i < data.size(); ++i) { | ||
| uint64_t val_norm = static_cast<uint64_t>(std::get<int64_t>(data[i])) - | ||
| static_cast<uint64_t>(min_val[i / block_size]); |
There was a problem hiding this comment.
Это явно должно выноситься в отдельный класс, занимающийся сжатием
No description provided.