yiguolei commented on code in PR #69070:
URL: https://github.com/apache/doris/pull/69070#discussion_r4312360343
##########
be/src/storage/key/row_key_encoder.cpp:
##########
@@ -80,85 +167,87 @@ void RowKeyEncoder::_add_default_sort_key_columns(const
TabletSchema& schema) {
}
void RowKeyEncoder::_add_sort_key_column(const TabletColumn& column) {
- _sort_key_coders.push_back(get_key_coder(column.type()));
+ _sort_key_coders.push_back(_key_column_coder(column));
_sort_key_index_size.push_back(cast_set<uint16_t>(column.index_length()));
}
-std::string RowKeyEncoder::full_encode(const
std::vector<IOlapColumnDataAccessor*>& key_columns,
+std::string RowKeyEncoder::full_encode(const std::vector<const IColumn*>&
key_columns,
size_t pos) const {
assert(_sort_key_index_size.size() == _sort_key_coders.size());
assert(key_columns.size() == _sort_key_coders.size());
return _full_encode(_sort_key_coders, key_columns, pos);
}
-std::string RowKeyEncoder::full_encode_primary_keys(
- const std::vector<IOlapColumnDataAccessor*>& key_columns, size_t pos)
const {
+std::string RowKeyEncoder::full_encode_primary_keys(const std::vector<const
IColumn*>& key_columns,
+ size_t pos) const {
return _full_encode(_primary_key_coders, key_columns, pos);
}
namespace {
// Shared row-key encoding base: for each key column, write a null marker for
// a null value, otherwise a normal marker followed by whatever `encode_field`
-// appends. `encode_field(cid, field, out)` is the only thing that differs
between
+// appends. `encode_field(cid, column, out)` is the only thing that differs
between
// the full key encode and the short-key prefix encode.
template <typename EncodeField>
-std::string encode_key_columns(const std::vector<IOlapColumnDataAccessor*>&
key_columns, size_t pos,
+std::string encode_key_columns(const std::vector<const IColumn*>& key_columns,
size_t pos,
EncodeField&& encode_field) {
std::string encoded_keys;
size_t cid = 0;
for (const auto& column : key_columns) {
- const auto* field = column->get_data_at(pos);
+ const auto* field = value_column_at(column, pos);
if (UNLIKELY(!field)) {
encoded_keys.push_back(KeyConsts::KEY_NULL_FIRST_MARKER);
++cid;
continue;
}
encoded_keys.push_back(KeyConsts::KEY_NORMAL_MARKER);
- encode_field(cid, field, &encoded_keys);
+ encode_field(cid, *field, &encoded_keys);
++cid;
}
return encoded_keys;
}
} // namespace
-std::string RowKeyEncoder::_full_encode(const std::vector<const KeyCoder*>&
key_coders,
- const
std::vector<IOlapColumnDataAccessor*>& key_columns,
+std::string RowKeyEncoder::_full_encode(const std::vector<KeyColumnCoder>&
key_coders,
+ const std::vector<const IColumn*>&
key_columns,
size_t pos) {
assert(key_columns.size() == key_coders.size());
return encode_key_columns(key_columns, pos,
- [&](size_t cid, const void* field, std::string*
out) {
- DCHECK(key_coders[cid] != nullptr);
-
key_coders[cid]->full_encode_ascending(field, out);
+ [&](size_t cid, const IColumn& column,
std::string* out) {
+ const KeyColumnCoder& coder =
key_coders[cid];
Review Comment:
add a row pos parameter to this lambda and encode_field(cid, *field,
row_pos, &encoded_keys);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]