mrhhsg commented on code in PR #63528:
URL: https://github.com/apache/doris/pull/63528#discussion_r4323143748


##########
be/src/core/data_type_serde/data_type_array_serde.cpp:
##########
@@ -593,6 +593,42 @@ Status DataTypeArraySerDe::_from_string(StringRef& str, 
IColumn& column,
     return Status::OK();
 }
 
+Status DataTypeArraySerDe::from_fe_string(const std::string& str, Field& 
field) const {
+    StringRef slice(str);
+    slice = slice.trim_whitespace();
+    if (slice.empty()) {
+        return Status::InvalidArgument("slice is empty!");
+    }
+    if (slice.front() != '[') {
+        return Status::InvalidArgument("Array does not start with '[' 
character, found '{}'",
+                                       slice.to_string());
+    }
+    if (slice.back() != ']') {
+        return Status::InvalidArgument("Array does not end with ']' character, 
found '{}'",
+                                       slice.to_string());
+    }
+
+    Array array;
+    if (slice.size > 2) {
+        slice = slice.substring(1, slice.size - 2);
+        slice = slice.trim_whitespace();
+        if (!slice.empty()) {
+            FormatOptions options;
+            auto split_result = ComplexTypeDeserializeUtil::split_by_delimiter(
+                    slice, [&](char c) { return c == options.collection_delim; 
});
+            array.reserve(split_result.size());

Review Comment:
   在 `a073a018f32` 重新核对:这条 P2 仍成立。`FieldVector` 是 
`std::vector<Field>`(`be/src/core/field.h`),`DataTypeArraySerDe::from_fe_string`
 为每个元素构造 `Field`,`ConstantColumnReader::new_iterator` 又复制 
`_value`;`SchemaChangeJob::_init_column_mapping` 也在独立生命周期中保留解析后的 `Field`。现有 
MemTracker 未覆盖这些递归缓冲区。
   
   先前作者回复说明了统一改造会涉及所有 `Field` 使用者。仅在数组解析处记账无法覆盖 
MAP/STRUCT、迭代器副本及释放时机,因此本轮没有做局部且不完整的修复,也不擅自改变已有 thread 状态。请维护者明确选择:A. 在本 PR 
完整覆盖这些生命周期;B. 接受本 PR 保留 P2、另开后续改动(推荐,避免把通用内存模型重构混入默认值修复)。选择 A 后再按决定补测试和实现。



-- 
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]

Reply via email to