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


##########
be/src/core/column/column_variant.cpp:
##########
@@ -458,6 +458,10 @@ void ColumnVariant::Subcolumn::insert_range_from(const 
Subcolumn& src, size_t st
     if (pos < src.data.size() && processed_rows < end) {
         size_t part_end = end - processed_rows;
         insert_from_part(src.data[pos], src.data_types[pos], 0, part_end);
+        processed_rows = end;
+    }
+    if (processed_rows < end) {
+        data.back()->insert_many_defaults(end - processed_rows);
     }

Review Comment:
   `insert_many_defaults(end - processed_rows)` can over-insert defaults when 
the requested range starts inside the pending lazy-default suffix 
(`current_num_of_defaults`). In that case `processed_rows` reflects the end of 
materialized parts (prefix+data) and may be < `start`, so `end - 
processed_rows` includes defaults that are *before* `start` and not in the 
requested range. Adjust the default-fill length to be based on 
`max(processed_rows, start)` to only materialize the portion of the suffix that 
overlaps `[start, end)`.



##########
be/src/core/column/column_variant.cpp:
##########
@@ -839,7 +843,7 @@ void ColumnVariant::for_each_subcolumn(ColumnCallback 
callback) {
 }
 
 void ColumnVariant::insert_from(const IColumn& src, size_t n) {
-    const auto* src_v = assert_cast<const ColumnVariant*>(&src);
+    const auto* src_v = check_and_get_column<ColumnVariant>(src);
     ENABLE_CHECK_CONSISTENCY(src_v);

Review Comment:
   `check_and_get_column<ColumnVariant>(src)` may return nullptr for unexpected 
callers (or if `src` is wrapped), and the subsequent 
`ENABLE_CHECK_CONSISTENCY(src_v)` / `src_v->...` will dereference a null 
pointer. Other column implementations here use `assert_cast` in `insert_from` 
to enforce the contract and fail fast with a clearer error; consider restoring 
that to avoid turning a type mismatch into a crash.



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