qidaye commented on code in PR #39248:
URL: https://github.com/apache/doris/pull/39248#discussion_r1714575882


##########
be/src/olap/rowset/segment_v2/inverted_index_writer.cpp:
##########
@@ -520,23 +512,33 @@ class InvertedIndexColumnWriterImpl : public 
InvertedIndexColumnWriter {
         return Status::OK();
     }
 
-    void add_numeric_values(const void* values, size_t count) {
+    Status add_numeric_values(const void* values, size_t count) {
         auto p = reinterpret_cast<const CppType*>(values);
         for (size_t i = 0; i < count; ++i) {
-            add_value(*p);
+            RETURN_IF_ERROR(add_value(*p));
+            _rid++;
             p++;
             _row_ids_seen_for_bkd++;
         }
+        return Status::OK();
     }
 
-    void add_value(const CppType& value) {
-        std::string new_value;
-        size_t value_length = sizeof(CppType);
+    Status add_value(const CppType& value) {
+        try {
+            std::string new_value;
+            size_t value_length = sizeof(CppType);
 
-        _value_key_coder->full_encode_ascending(&value, &new_value);
-        _bkd_writer->add((const uint8_t*)new_value.c_str(), value_length, 
_rid);
+            
DBUG_EXECUTE_IF("InvertedIndexColumnWriterImpl::add_value_bkd_writer_add_throw_error",
 {
+                _CLTHROWA(CL_ERR_IllegalArgument, ("packedValue should be 
length=xxx"));
+            });
 
-        _rid++;

Review Comment:
   In order to reuse `add_value` function in `add_array_values`, I moved the 
`_rid++` to the caller `add_numeric_values` in line 519.



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to