hello-stephen commented on code in PR #70774:
URL: https://github.com/apache/doris/pull/70774#discussion_r4784606137


##########
be/test/core/value/bitmap_value_test.cpp:
##########
@@ -2009,4 +2201,181 @@ TEST(BitmapValueTest, 
deserialize_consumes_actual_input_size) {
         config::enable_set_in_bitmap_value = old_enable_set;
     }
 }
-} // namespace doris
+
+TEST(BitmapValueTest, write_matches_copy_optimize) {
+    const auto old_version = config::bitmap_serialize_version;
+
+    auto verify_bitmap = [](const BitmapValue& bitmap, bool expect_exact_bytes 
= true) {
+        const auto* backing = bitmap._bitmap.get();
+        BitmapValue expected_bm(bitmap);
+        expected_bm.optimize();
+
+        for (int16_t version : {int16_t {1}, int16_t {2}}) {
+            config::bitmap_serialize_version = version;
+            const size_t raw_size = bitmap.getSizeInBytes();
+            std::string expected;
+            expected_bm.write(expected);

Review Comment:
   [P3] Verify the streamed values independently of the new writer. 
`expected_bm.write()` invokes the same streaming codec as `bitmap.write()`, and 
the exact-byte branch never decodes `streamed`, so a shared header/offset error 
can pass. Always check consumed length and membership against the original 
bitmap (also on byte equality), and add source fixtures with inefficient RUN 
containers that exercise RUN-to-ARRAY and RUN-to-BITSET. The current fixtures 
do not explicitly establish either reverse-conversion branch.



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