eldenmoon commented on code in PR #65561:
URL: https://github.com/apache/doris/pull/65561#discussion_r3613473385


##########
be/src/util/variant/variant_encoded_block.h:
##########
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <span>
+
+#include "core/string_ref.h"
+#include "util/variant/variant_metadata.h"
+#include "util/variant/variant_value.h"
+
+namespace doris {
+
+class VariantBlockBuilder;
+struct VariantEncodedBlockStorage;
+
+// Borrows one immutable shared-metadata encoding unit. Offsets are directly 
compatible with
+// ColumnString and always contain num_rows() + 1 entries.
+class VariantEncodedBlockView {
+public:
+    size_t num_rows() const noexcept;
+    VariantMetadataRef metadata_ref() const noexcept { return _metadata; }
+    VariantValueRef value_at(size_t row) const;
+    StringRef value_bytes() const noexcept { return _values; }
+    std::span<const uint32_t> value_offsets() const noexcept { return 
_offsets; }
+
+private:
+    friend class VariantEncodedBlock;
+
+    VariantEncodedBlockView(VariantMetadataRef metadata, StringRef values,
+                            std::span<const uint32_t> offsets) noexcept
+            : _metadata(metadata), _values(values), _offsets(offsets) {}
+
+    VariantMetadataRef _metadata;
+    StringRef _values;
+    std::span<const uint32_t> _offsets;
+};
+
+// Owns one immutable two-pass encoding unit. Views and value refs remain 
valid until this block is
+// destroyed or moved.
+class VariantEncodedBlock {

Review Comment:
   保留 VariantEncodedBlock。
   不用 VariantValueRef 替代 block。
   当前可以删除 VariantEncodedBlockView,让列适配器直接接收 const VariantEncodedBlock&。
   VariantValueRef 继续只用于单行、子节点遍历、equality/hash/canonical 等 value-level 操作。



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