Skip to content

Commit

Permalink
fix string size
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 14, 2025
1 parent e500a81 commit 8bbb062
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dbms/src/Columns/ColumnString.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class ColumnString final : public COWPtrHelper<IColumn, ColumnString>
const TiDB::TiDBCollatorPtr & collator,
String & sort_key_container) const override
{
size_t string_size = sizeAt(n);
auto string_size = static_cast<UInt32>(sizeAt(n));
size_t offset = offsetAt(n);
const void * src = &chars[offset];

Expand All @@ -277,7 +277,7 @@ class ColumnString final : public COWPtrHelper<IColumn, ColumnString>
// Skip last zero byte.
auto sort_key
= collator->sortKeyFastPath(reinterpret_cast<const char *>(src), string_size - 1, sort_key_container);
string_size = sort_key.size;
string_size = static_cast<UInt32>(sort_key.size);
src = sort_key.data;
}
res.size = sizeof(string_size) + string_size;
Expand All @@ -290,7 +290,8 @@ class ColumnString final : public COWPtrHelper<IColumn, ColumnString>

inline const char * deserializeAndInsertFromArena(const char * pos, const TiDB::TiDBCollatorPtr & collator) override
{
const size_t string_size = *reinterpret_cast<const size_t *>(pos);
// const size_t string_size = *reinterpret_cast<const size_t *>(pos);
const UInt32 string_size = *reinterpret_cast<const UInt32 *>(pos);
pos += sizeof(string_size);
if (likely(collator != nullptr))
insertData(pos, string_size);
Expand Down

0 comments on commit 8bbb062

Please sign in to comment.