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


##########
be/src/core/column/column_variant.cpp:
##########
@@ -1835,6 +1843,12 @@ bool ColumnVariant::is_visible_root_value(size_t nrow) 
const {
         }
     }
 
+    const auto& sparse_column_map = assert_cast<const 
ColumnMap&>(*serialized_sparse_column);
+    const auto& sparse_offsets = sparse_column_map.get_offsets();
+    if (sparse_offsets[nrow - 1] != sparse_offsets[nrow]) {
+        return false;
+    }

Review Comment:
   `is_visible_root_value()` indexes `Offsets64` with `nrow - 1` where `nrow` 
is a `size_t`. For `nrow == 0`, this relies on unsigned underflow + 
implementation-defined conversion to `ssize_t` in `PaddedPODArray::operator[]`, 
which is easy to misread and can break on non-standard platforms/tooling. 
Prefer the explicit `static_cast<ssize_t>(nrow) - 1` pattern already used 
elsewhere in this file (e.g. `serialize_from_doc_value_to_json_format`).



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