Copilot commented on code in PR #50174:
URL: https://github.com/apache/doris/pull/50174#discussion_r2079523578


##########
be/src/vec/core/field.h:
##########
@@ -158,52 +158,60 @@ using FieldMap = std::map<String, Field>;
 DEFINE_FIELD_MAP(VariantMap);
 #undef DEFINE_FIELD_MAP
 
+//TODO: rethink if we really need this? it only save one pointer from 
std::string
+// not POD type so could only use read/write_json_binary instead of 
read/write_binary
 class JsonbField {
 public:
     JsonbField() = default;
+    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
 
     JsonbField(const char* ptr, size_t len) : size(len) {
-        data = new char[size];
+        data = std::make_unique<char[]>(size);
         if (!data) {
             throw Exception(Status::FatalError("new data buffer failed, size: 
{}", size));
         }

Review Comment:
   The subsequent null check after allocating with std::make_unique is 
redundant since std::make_unique will throw std::bad_alloc on failure. Consider 
removing this check to simplify the code.
   ```suggestion
   
   ```



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