Skip to content

To review#24

Open
Zhegl wants to merge 25 commits into
reviewedfrom
to-review
Open

To review#24
Zhegl wants to merge 25 commits into
reviewedfrom
to-review

Conversation

@Zhegl

@Zhegl Zhegl commented Jun 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/engine/column_utils.h
Comment on lines +9 to +10
return std::visit(
[](const auto& left, const auto& right) -> bool {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучше делать std::visit по одному параметру и в теле делать std::get_if. Иначе очень много кода генерируется и бинарь раздувается

Comment thread src/engine/engine.cpp
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Хм, а не получается ли тут так, что у тебя эта штуковина зовется для 4-й, 5-й и так далее групп, но не зовется для 1-й, 2-й и 3-й?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А еще хорошо бы это спрятать в самого reader_

Comment thread src/engine/engine.cpp
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));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Почему не std::memcpy?

Comment thread src/engine/engine.cpp
// AggregateOp

inline void AggregateOp::UpdateSlot(AggSlot& slot, EngineBatch& batch, RowIndex i, bool only_count_all) {
if (has_count_all_) { slot.count++; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

МБ это лучше вытаскивать в отдельный оператор, чтобы тут не было if-а на каждую строчку?

Comment thread src/engine/engine.cpp
Comment on lines +176 to +178
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

А это ускоряет?

Comment thread src/engine/parser.cpp
Comment on lines +174 to +176
for (char c : str_val) {
if (c != '%') { stripped.push_back(c); }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Кажется, для запроса %ab%cd%ef% тут будет ошибка (ты будешь искать подстроку bc, например)?

Comment thread src/engine/predicates.h
Comment on lines +34 to +43
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_;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно было сделать компаратор шаблонным, разово реализовать, а остальное выразить через using

Comment thread src/engine/predicates.h
Comment on lines +56 to +57
class StrConstNE : public FilterPredicate {
public:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Смущает, что везде под строки отдельный класс заводится. Будто бы тоже как-то шаблонами можно это обойти

return result;
}

}; // namespace column_engine No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В конце неймспейса не нужны ;, а еще в конце файла нужны строки. Эх, вот бы существовала какая-нибудь тулза, следящая за форматированием

Comment thread src/types/types.cpp
Comment on lines +219 to +224
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]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это явно должно выноситься в отдельный класс, занимающийся сжатием

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.

2 participants