Skip to content

Commit

Permalink
update'
Browse files Browse the repository at this point in the history
  • Loading branch information
mymeiyi committed Jul 30, 2024
1 parent 5bc62b7 commit 516ede2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
25 changes: 3 additions & 22 deletions be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,39 +1041,20 @@ std::string VerticalSegmentWriter::_full_encode_keys(
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos) {
assert(_key_index_size.size() == _num_key_columns);
assert(key_columns.size() == _num_key_columns && _key_coders.size() == _num_key_columns);

std::string encoded_keys;
size_t cid = 0;
for (const auto& column : key_columns) {
auto field = column->get_data_at(pos);
if (UNLIKELY(!field)) {
encoded_keys.push_back(KEY_NULL_FIRST_MARKER);
++cid;
continue;
}
encoded_keys.push_back(KEY_NORMAL_MARKER);
_key_coders[cid]->full_encode_ascending(field, &encoded_keys);
++cid;
}
return encoded_keys;
return _full_encode_keys(_key_coders, key_columns, pos);
}

std::string VerticalSegmentWriter::_full_encode_keys(
const std::vector<const KeyCoder*>& key_coders,
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos,
bool null_first) {
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos) {
assert(key_columns.size() == key_coders.size());

std::string encoded_keys;
size_t cid = 0;
for (const auto& column : key_columns) {
auto field = column->get_data_at(pos);
if (UNLIKELY(!field)) {
if (null_first) {
encoded_keys.push_back(KEY_NULL_FIRST_MARKER);
} else {
encoded_keys.push_back(KEY_NORMAL_MARKER);
}
encoded_keys.push_back(KEY_NULL_FIRST_MARKER);
++cid;
continue;
}
Expand Down
3 changes: 1 addition & 2 deletions be/src/olap/rowset/segment_v2/vertical_segment_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ class VerticalSegmentWriter {
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos);
std::string _full_encode_keys(
const std::vector<const KeyCoder*>& key_coders,
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos,
bool null_first = true);
const std::vector<vectorized::IOlapColumnDataAccessor*>& key_columns, size_t pos);
// used for unique-key with merge on write
void _encode_seq_column(const vectorized::IOlapColumnDataAccessor* seq_column, size_t pos,
string* encoded_keys);
Expand Down

0 comments on commit 516ede2

Please sign in to comment.