yiguolei commented on code in PR #66204:
URL: https://github.com/apache/doris/pull/66204#discussion_r3728375960


##########
be/src/core/value/variant/variant_field.cpp:
##########
@@ -283,15 +284,55 @@ void validate_variant_payload(VariantRef value) {
 VariantField::VariantField(std::unique_ptr<char[]> data, size_t size) noexcept
         : _data(std::move(data)), _size(size) {}
 
-VariantField::VariantField(const VariantField& other) : _size(other._size) {
+VariantField::~VariantField() = default;
+
+VariantField::VariantField(VariantMap legacy)
+        : _legacy_representation(true), 
_legacy(std::make_unique<VariantMap>(std::move(legacy))) {}
+
+bool VariantField::is_legacy() const noexcept {
+    return _legacy_representation;
+}
+
+VariantMap& VariantField::legacy_map() {
+    if (!_legacy_representation) {
+        throw Exception(ErrorCode::INVALID_ARGUMENT,
+                        "Encoded VariantField does not contain a legacy 
VariantMap");
+    }
+    if (_legacy == nullptr) {
+        _legacy = std::make_unique<VariantMap>();

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]

Reply via email to