Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions be/src/vec/columns/column_decimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ const char* ColumnDecimal<T>::deserialize_and_insert_from_arena(const char* pos)
return pos + sizeof(T);
}

template <typename T>
size_t ColumnDecimal<T>::get_max_row_byte_size() const {
return sizeof(T);
}

template <typename T>
void ColumnDecimal<T>::serialize_vec(std::vector<StringRef>& keys, size_t num_rows,
size_t max_row_byte_size) const {
for (size_t i = 0; i < num_rows; ++i) {
memcpy(const_cast<char*>(keys[i].data + keys[i].size), &data[i], sizeof(T));
keys[i].size += sizeof(T);
}
}

template <typename T>
void ColumnDecimal<T>::serialize_vec_with_null_map(std::vector<StringRef>& keys, size_t num_rows,
const uint8_t* null_map,
size_t max_row_byte_size) const {
for (size_t i = 0; i < num_rows; ++i) {
if (null_map[i] == 0) {
memcpy(const_cast<char*>(keys[i].data + keys[i].size), &data[i], sizeof(T));
keys[i].size += sizeof(T);
}
}
}

template <typename T>
UInt64 ColumnDecimal<T>::get64(size_t n) const {
if constexpr (sizeof(T) > sizeof(UInt64)) {
Expand Down
10 changes: 10 additions & 0 deletions be/src/vec/columns/column_decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ class ColumnDecimal final : public COWHelper<ColumnVectorHelper, ColumnDecimal<T

StringRef serialize_value_into_arena(size_t n, Arena& arena, char const*& begin) const override;
const char* deserialize_and_insert_from_arena(const char* pos) override;

virtual size_t get_max_row_byte_size() const override;

virtual void serialize_vec(std::vector<StringRef>& keys, size_t num_rows,
size_t max_row_byte_size) const override;

virtual void serialize_vec_with_null_map(std::vector<StringRef>& keys, size_t num_rows,
const uint8_t* null_map,
size_t max_row_byte_size) const override;

void update_hash_with_value(size_t n, SipHash& hash) const override;
int compare_at(size_t n, size_t m, const IColumn& rhs_, int nan_direction_hint) const override;
void get_permutation(bool reverse, size_t limit, int nan_direction_hint,
Expand Down