Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
Signed-off-by: guo-shaoge <[email protected]>
  • Loading branch information
guo-shaoge committed Jan 7, 2025
1 parent 19982d3 commit 47cdf91
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Columns/ColumnArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void ColumnArray::serializeToPosImpl(
RUNTIME_CHECK_MSG(length <= pos.size(), "length({}) > size of pos({})", length, pos.size());
RUNTIME_CHECK_MSG(start + length <= size(), "start({}) + length({}) > size of column({})", start, length, size());

/// countSerializeByteSizeUnique has already checked that the size of one element is not greater than UINT32_MAX
/// countSerializeByteSize has already checked that the size of one element is not greater than UINT32_MAX
for (size_t i = 0; i < length; ++i)
{
if constexpr (has_null)
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Columns/ColumnDecimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ ALWAYS_INLINE inline size_t getDecimal256BytesSize(const Decimal256 & val)

ALWAYS_INLINE inline char * serializeDecimal256Helper(char * dst, const Decimal256 & data)
{
/// deserialize Decimal256 in `Non-trivial, Binary` way, the deserialization logical is
/// copied from https://github.com/pingcap/boost-extra/blob/master/boost/multiprecision/cpp_int/serialize.hpp#L133
const auto & val = data.value.backend();

const bool s = val.sign();
Expand All @@ -81,8 +83,6 @@ ALWAYS_INLINE inline char * serializeDecimal256Helper(char * dst, const Decimal2

ALWAYS_INLINE inline const char * deserializeDecimal256Helper(Decimal256 & value, const char * ptr)
{
/// deserialize Decimal256 in `Non-trivial, Binary` way, the deserialization logical is
/// copied from https://github.com/pingcap/boost-extra/blob/master/boost/multiprecision/cpp_int/serialize.hpp#L133
auto & val = value.value.backend();

size_t offset = 0;
Expand Down Expand Up @@ -284,7 +284,7 @@ void ColumnDecimal<T>::deserializeAndInsertFromPosImpl(
size_t size = pos.size();

// is_complex_decimal256 is true means Decimal256 is serialized by [bool, limb_count, n * limb].
// nt optimization is not used because serialized data is not aligned by 64B.
// NT optimization is not implemented for simplicity.
static const bool is_complex_decimal256 = (ensure_unique && is_Decimal256);

#ifdef TIFLASH_ENABLE_AVX_SUPPORT
Expand Down
2 changes: 0 additions & 2 deletions dbms/src/Columns/ColumnString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ void ColumnString::deserializeAndInsertFromPosImpl(
memcpySmallAllowReadWriteOverflow15(&chars[char_size], pos[i], str_size);
char_size += str_size;

// todo add unit test
if constexpr (add_terminating_zero)
{
chars[char_size] = 0;
Expand Down Expand Up @@ -1018,7 +1017,6 @@ void ColumnString::deserializeAndInsertFromPosForColumnArrayImpl(
{
for (size_t i = 0; i < size; ++i)
{
// TODO add unit test
for (size_t j = array_offsets[start_point + i - 1]; j < array_offsets[start_point + i]; ++j)
{
UInt32 str_size;
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Columns/IColumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class IColumn : public COWPtr<IColumn>
/// while (xxx)
/// {
/// for (auto & column_ptr : mutable_columns)
/// column_ptr->deserializeAndInsertFromPosUnique(pos, align_buffer, true);
/// column_ptr->deserializeAndInsertFromPos(pos, align_buffer, true);
/// }
/// for (auto & column_ptr : mutable_columns)
/// column_ptr->flushNTAlignBuffer();
Expand Down

0 comments on commit 47cdf91

Please sign in to comment.