yiguolei commented on code in PR #63291:
URL: https://github.com/apache/doris/pull/63291#discussion_r3271743509
##########
be/src/core/data_type_serde/data_type_string_serde.cpp:
##########
@@ -462,22 +462,12 @@ Status
DataTypeStringSerDeBase<ColumnType>::from_string(StringRef& str, IColumn&
// Deserializes a STRING/VARCHAR/CHAR value from its OLAP string representation
// (e.g. from ZoneMap protobuf). This is the inverse of to_olap_string().
-//
-// For CHAR type: if the string is shorter than the declared column length
(_len),
-// pads with '\0' bytes to reach _len. This preserves CHAR's fixed-length
semantics.
-// For STRING/VARCHAR: stores the string as-is.
-//
-// Examples:
-// CHAR(10), str="hello" => field = "hello\0\0\0\0\0" (10 bytes)
-// VARCHAR, str="hello" => field = "hello" (5 bytes)
template <typename ColumnType>
Status DataTypeStringSerDeBase<ColumnType>::from_olap_string(const
std::string& str, Field& field,
const
FormatOptions& options) const {
- if (cast_set<int>(str.size()) < _len) {
- DCHECK_EQ(_type, TYPE_CHAR);
- std::string tmp(_len, '\0');
- memcpy(tmp.data(), str.data(), str.size());
- field = Field::create_field<TYPE_CHAR>(std::move(tmp));
+ if (_type == TYPE_CHAR) {
Review Comment:
把这两个逻辑合并了
--
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]