github-actions[bot] commented on code in PR #66206:
URL: https://github.com/apache/doris/pull/66206#discussion_r3679813200


##########
be/src/core/column/variant_v2/column_variant_v2.cpp:
##########
@@ -724,6 +794,37 @@ void ColumnVariantV2::insert_range_from( // 
NOLINT(readability-function-size)
         return;
     }
 
+    if (!_shredded && !_typed && empty() && _metadatas->empty() && 
source._shredded) {
+        // IColumn::cut() inserts into an empty clone. Select the physical 
tree directly because an
+        // incomplete leaf projection cannot be reconstructed merely to copy a 
row range.
+        _shredded = start == 0 && length == source.size()
+                            ? source._shredded
+                            : source._shredded->select_range(start, length);
+        _check_invariants();
+        return;
+    }
+    if (_shredded && source._shredded) {
+        auto selected_source = start == 0 && length == source.size()
+                                       ? source._shredded
+                                       : source._shredded->select_range(start, 
length);
+        if (!_shredded.unique()) {
+            _shredded = _shredded->select_range(0, size());
+        }
+        // A partial physical projection has no metadata/value pair to encode. 
Preserve that
+        // invariant by merging compatible scanner batches before the 
canonical fallback below.
+        if (_shredded->try_append(*selected_source)) {

Review Comment:
   [P1] Preserve incompatible per-file states until after projection
   
   A failed `try_append()` is not safely recoverable by materializing both 
sides. Scanner padding merges raw blocks across splits before 
`_do_projections()`, and valid files can produce different states for the same 
path: residual statistics may expand one file to a complete wrapper while 
another retains an incomplete leaf, or their shredding schemas may differ. 
`try_append()` then returns false and lines 820-824 call 
`ensure_encoded()`/`materialized_column()` on an intentionally incomplete 
state, so the query fails depending on file and block sizes. Please preserve 
heterogeneous states through padding or evaluate the path before merging them, 
with a small two-file complete-plus-partial regression.



##########
be/src/core/column/variant_v2/column_variant_v2.cpp:
##########
@@ -724,6 +794,37 @@ void ColumnVariantV2::insert_range_from( // 
NOLINT(readability-function-size)
         return;
     }
 
+    if (!_shredded && !_typed && empty() && _metadatas->empty() && 
source._shredded) {
+        // IColumn::cut() inserts into an empty clone. Select the physical 
tree directly because an
+        // incomplete leaf projection cannot be reconstructed merely to copy a 
row range.
+        _shredded = start == 0 && length == source.size()
+                            ? source._shredded
+                            : source._shredded->select_range(start, length);
+        _check_invariants();
+        return;
+    }
+    if (_shredded && source._shredded) {
+        auto selected_source = start == 0 && length == source.size()
+                                       ? source._shredded
+                                       : source._shredded->select_range(start, 
length);
+        if (!_shredded.unique()) {

Review Comment:
   [P1] Keep the shared-state detachment portable to C++20
   
   `std::shared_ptr::unique()` is not available in the required C++20 libc++ 
interface, and the current `BE UT (macOS)` job fails here with `no member named 
'unique' in 'std::shared_ptr<...>'`. Please use a supported 
ownership/detachment pattern (for example, the repository's normal 
`use_count()`-based COW check or an unconditional safe clone) and keep the 
macOS BE build green.



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