This is an automated email from the ASF dual-hosted git repository.

wyxxxcat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 5932ee30ad5 [fix](test) Restore bitmap config flags in bitmap unit 
tests (#71341)
5932ee30ad5 is described below

commit 5932ee30ad5e5332fff52e4152541fbe19d9d94c
Author: linrrarity <[email protected]>
AuthorDate: Fri Dec 4 00:02:23 2026 +0800

    [fix](test) Restore bitmap config flags in bitmap unit tests (#71341)
    
    ### Background
    
    `BitmapValue` chooses between `SINGLE` and `SET` representations based
    on the global `config::enable_set_in_bitmap_value` flag (default
    `true`), and selects serialization format v1/v2 via
    `config::bitmap_serialize_version` (default `1`).
    
    ### What problem does this PR solve?
    
    Issue Number: None
    Related PR: None
    PR Type: Test
    
    Problem Summary:
    
    `BitmapValueTest.bitmap_single_convert` expects `BitmapValue::SINGLE`
    and `BitmapValue::BITMAP` transitions without disabling
    `config::enable_set_in_bitmap_value`, so running it in isolation fails
    under the default `true` setting (full-suite runs passed only because
    earlier tests left the flag set to `false`). This PR saves and restores
    `config::enable_set_in_bitmap_value` and
    `config::bitmap_serialize_version` across bitmap unit tests so each test
    runs independently of execution order.
    
    ```text
    Before (master):
      Isolated run:
        enable_set_in_bitmap_value = true (default)
        -> bitmap_single_convert: bitmap.add(1) -> SET (3) != SINGLE (1)  [FAIL]
    
      Full-suite run:
        earlier tests leave enable_set_in_bitmap_value = false (hardcoded)
        -> bitmap_single_convert sees false -> SINGLE (1)                 
[masked]
    
    After (this PR):
      Every test saves original config values on entry and restores them on 
exit;
      bitmap_single_convert explicitly sets enable_set_in_bitmap_value = false
      and function_bitmap_to_base64 explicitly initializes 
bitmap_serialize_version = 1.
    ```
    
    ### Details
    
    Reproducer (isolated BE UT run):
    
    ```bash
    ./be/ut_build_ASAN/test/doris_be_test 
--gtest_filter='BitmapValueTest.bitmap_single_convert'
    ```
    
    Before:
    ```text
    ../test/core/value/bitmap_value_test.cpp:1531: Failure
    Expected equality of these values:
      BitmapValue::SINGLE
        Which is: 1
      bitmap._type
        Which is: 3
    ```
    
    After:
    ```text
    [==========] Running 1 test from 1 test suite.
    [ RUN      ] BitmapValueTest.bitmap_single_convert
    [       OK ] BitmapValueTest.bitmap_single_convert (0 ms)
    [  PASSED  ] 1 test.
    ```
    
    ### Testing
    
    - Passed isolated single-process run for
    `BitmapValueTest.bitmap_single_convert` and full suite run for
    `BitmapValueTest.*:function_bitmap_test.*` (61/61 tests passed via
    `run-be-ut.sh`).
    - Passed 3 shuffled repeats
    (`--gtest_filter="BitmapValueTest.*:function_bitmap_test.*"
    --gtest_shuffle --gtest_repeat=3`, 61/61 tests passed per iteration).
    
    ### Release note
    
    None.
    
    ### Check List (For Author)
    
    - Behavior changed: No
    - Does this need documentation: No
    - Pre-submission status: Ready
    
    ### AI Disclosure
    
    - Tool: Antigravity
    - Generated: Test config save/restore edits and PR description draft
    - Human review: Reviewed root cause, diff, and BE UT verification
    results
---
 be/test/core/value/bitmap_value_test.cpp        | 205 ++++++++++++++----------
 be/test/exprs/function/function_bitmap_test.cpp |  43 +++--
 2 files changed, 141 insertions(+), 107 deletions(-)

diff --git a/be/test/core/value/bitmap_value_test.cpp 
b/be/test/core/value/bitmap_value_test.cpp
index 9bd10140c52..f1e8774efc3 100644
--- a/be/test/core/value/bitmap_value_test.cpp
+++ b/be/test/core/value/bitmap_value_test.cpp
@@ -277,6 +277,7 @@ TEST(BitmapValueTest, Roaring64Map_iterators) {
 }
 
 TEST(BitmapValueTest, set) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = false;
     BitmapValue bitmap_value;
 
@@ -319,10 +320,11 @@ TEST(BitmapValueTest, set) {
     bitmap_value6.add(4294967297);
     EXPECT_EQ(bitmap_value6.get_type_code(), BitmapTypeCode::BITMAP64);
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, add) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     std::vector<uint64_t> values(1);
@@ -367,7 +369,7 @@ TEST(BitmapValueTest, add) {
     std::iota(values.begin(), values.end(), 32);
     bitmap_value.add_many(values.data(), values.size());
     EXPECT_EQ(bitmap_value.get_type_code(), BitmapTypeCode::BITMAP32);
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, small_set_try_insert_many_over_capacity) {
@@ -516,6 +518,7 @@ TEST(BitmapValueTest, copy_operator) {
 
 // '-=', '|=', '&=', '^='
 TEST(BitmapValueTest, operators) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     BitmapValue left_empty;
     BitmapValue right_emtpy;
@@ -577,10 +580,11 @@ TEST(BitmapValueTest, operators) {
     check_bitmap_value_operator(left_bitmap, right_set);
     check_bitmap_value_operator(left_bitmap, right_bitmap);
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_operator_cow_with_set_rhs) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     std::vector<uint64_t> values(128);
@@ -611,10 +615,11 @@ TEST(BitmapValueTest, bitmap_operator_cow_with_set_rhs) {
     EXPECT_FALSE(bitmap.contains(1));
     EXPECT_TRUE(copied.contains(1));
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_xor_single_and_set) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     BitmapValue lhs_single(1);
@@ -629,10 +634,11 @@ TEST(BitmapValueTest, bitmap_xor_single_and_set) {
     lhs_single ^= BitmapValue({1, 2});
     EXPECT_STREQ("2", lhs_single.to_string().c_str());
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_xor_same_set_returns_empty) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     BitmapValue lhs({1, 2});
@@ -641,10 +647,11 @@ TEST(BitmapValueTest, bitmap_xor_same_set_returns_empty) {
     EXPECT_EQ(0, lhs.cardinality());
     EXPECT_EQ(BitmapTypeCode::EMPTY, lhs.get_type_code());
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_xor_set_bitmap_clear_stale_set) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     BitmapValue lhs({1, 2});
@@ -659,7 +666,7 @@ TEST(BitmapValueTest, 
bitmap_xor_set_bitmap_clear_stale_set) {
 
     EXPECT_STREQ("33", lhs.to_string().c_str());
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 void check_bitmap_equal(const BitmapValue& left, const BitmapValue& right) {
@@ -691,6 +698,7 @@ void check_bitmap_values(const BitmapValue& bitmap, 
std::vector<uint64_t> expect
 }
 
 TEST(BitmapValueTest, write_read) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     BitmapValue bitmap_empty;
     BitmapValue bitmap_single(1);
@@ -747,10 +755,11 @@ TEST(BitmapValueTest, write_read) {
 
     check_bitmap_equal(deserialized, bitmap);
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, set_to_string) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     BitmapValue bitmap;
     bitmap.add(1);
@@ -760,10 +769,11 @@ TEST(BitmapValueTest, set_to_string) {
     EXPECT_EQ(bitmap.get_type_code(), BitmapTypeCode::SET);
 
     EXPECT_EQ(bitmap.to_string(), "1,2,3");
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, min_max) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     BitmapValue bitmap;
 
@@ -808,10 +818,11 @@ TEST(BitmapValueTest, min_max) {
     EXPECT_EQ(max, bitmap.maximum());
     EXPECT_EQ(max, 42949672970 + 63);
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, sub_range_limit) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     BitmapValue bitmap;
 
@@ -888,7 +899,7 @@ TEST(BitmapValueTest, sub_range_limit) {
     EXPECT_EQ(ret, 10);
     ret = bitmap.offset_limit(100, 10, &out);
     EXPECT_EQ(ret, 10);
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, offset_limit_singleton) {
@@ -907,6 +918,7 @@ TEST(BitmapValueTest, offset_limit_singleton) {
 }
 
 TEST(BitmapValueTest, offset_limit_negative_cardinality_for_set) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
 
     BitmapValue bitmap({1, 2, 3});
@@ -915,7 +927,7 @@ TEST(BitmapValueTest, 
offset_limit_negative_cardinality_for_set) {
     EXPECT_EQ(ret, 2);
     EXPECT_STREQ("1,2", out.to_string().c_str());
 
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 void bitmap_checker_for_all_type(const std::function<void(const 
BitmapValue&)>& checker) {
@@ -946,6 +958,7 @@ void bitmap_checker_for_all_type(const 
std::function<void(const BitmapValue&)>&
 }
 
 TEST(BitmapValueTest, to_array) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     auto checker = [](const BitmapValue& bitmap) {
         auto size = bitmap.cardinality();
@@ -963,10 +976,11 @@ TEST(BitmapValueTest, to_array) {
     };
 
     bitmap_checker_for_all_type(checker);
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, BitmapValueIterator) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
     config::enable_set_in_bitmap_value = true;
     auto checker = [](const BitmapValue& bitmap) {
         auto begin = bitmap.begin();
@@ -988,29 +1002,36 @@ TEST(BitmapValueTest, BitmapValueIterator) {
     };
 
     bitmap_checker_for_all_type(checker);
-    config::enable_set_in_bitmap_value = false;
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, copy) {
-    BitmapValue empty;
-    BitmapValue single(1024);
-    BitmapValue bitmap({1024, 1025, 1026});
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    for (bool enable_set : {false, true}) {
+        config::enable_set_in_bitmap_value = enable_set;
 
-    BitmapValue copied = bitmap;
-    EXPECT_TRUE(copied.contains(1024));
-    EXPECT_TRUE(copied.contains(1025));
-    EXPECT_TRUE(copied.contains(1026));
-    copied &= single;
-
-    // value of copied changed.
-    EXPECT_TRUE(copied.contains(1024));
-    EXPECT_FALSE(copied.contains(1025));
-    EXPECT_FALSE(copied.contains(1026));
-
-    // value of bitmap not changed.
-    EXPECT_TRUE(bitmap.contains(1024));
-    EXPECT_TRUE(bitmap.contains(1025));
-    EXPECT_TRUE(bitmap.contains(1026));
+        BitmapValue empty;
+        BitmapValue single(1024);
+        BitmapValue bitmap({1024, 1025, 1026});
+        EXPECT_EQ(enable_set ? BitmapValue::SET : BitmapValue::BITMAP, 
bitmap._type);
+
+        BitmapValue copied = bitmap;
+        EXPECT_TRUE(copied.contains(1024));
+        EXPECT_TRUE(copied.contains(1025));
+        EXPECT_TRUE(copied.contains(1026));
+        copied &= single;
+
+        // value of copied changed.
+        EXPECT_TRUE(copied.contains(1024));
+        EXPECT_FALSE(copied.contains(1025));
+        EXPECT_FALSE(copied.contains(1026));
+
+        // value of bitmap not changed.
+        EXPECT_TRUE(bitmap.contains(1024));
+        EXPECT_TRUE(bitmap.contains(1025));
+        EXPECT_TRUE(bitmap.contains(1026));
+    }
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_union) {
@@ -1503,25 +1524,36 @@ TEST(BitmapValueTest, bitmap_to_string) {
 }
 
 TEST(BitmapValueTest, sub_limit) {
-    BitmapValue bitmap({1, 2, 3, 10, 11, 5, 6, 7, 8, 9});
-    BitmapValue ret_bitmap1;
-    EXPECT_EQ(5, bitmap.sub_limit(0, 5, &ret_bitmap1));
-    EXPECT_STREQ("1,2,3,5,6", ret_bitmap1.to_string().c_str());
-
-    BitmapValue ret_bitmap2;
-    EXPECT_EQ(6, bitmap.sub_limit(6, 10, &ret_bitmap2));
-    EXPECT_STREQ("6,7,8,9,10,11", ret_bitmap2.to_string().c_str());
-
-    BitmapValue ret_bitmap3;
-    EXPECT_EQ(3, bitmap.sub_limit(5, 3, &ret_bitmap3));
-    EXPECT_STREQ("5,6,7", ret_bitmap3.to_string().c_str());
-
-    BitmapValue ret_bitmap4;
-    EXPECT_EQ(5, bitmap.sub_limit(2, 5, &ret_bitmap4));
-    EXPECT_STREQ("2,3,5,6,7", ret_bitmap4.to_string().c_str());
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    for (bool enable_set : {false, true}) {
+        config::enable_set_in_bitmap_value = enable_set;
+
+        BitmapValue bitmap({1, 2, 3, 10, 11, 5, 6, 7, 8, 9});
+        EXPECT_EQ(enable_set ? BitmapValue::SET : BitmapValue::BITMAP, 
bitmap._type);
+
+        BitmapValue ret_bitmap1;
+        EXPECT_EQ(5, bitmap.sub_limit(0, 5, &ret_bitmap1));
+        EXPECT_STREQ("1,2,3,5,6", ret_bitmap1.to_string().c_str());
+
+        BitmapValue ret_bitmap2;
+        EXPECT_EQ(6, bitmap.sub_limit(6, 10, &ret_bitmap2));
+        EXPECT_STREQ("6,7,8,9,10,11", ret_bitmap2.to_string().c_str());
+
+        BitmapValue ret_bitmap3;
+        EXPECT_EQ(3, bitmap.sub_limit(5, 3, &ret_bitmap3));
+        EXPECT_STREQ("5,6,7", ret_bitmap3.to_string().c_str());
+
+        BitmapValue ret_bitmap4;
+        EXPECT_EQ(5, bitmap.sub_limit(2, 5, &ret_bitmap4));
+        EXPECT_STREQ("2,3,5,6,7", ret_bitmap4.to_string().c_str());
+    }
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_single_convert) {
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    config::enable_set_in_bitmap_value = false;
+
     BitmapValue bitmap;
     EXPECT_STREQ("", bitmap.to_string().c_str());
     bitmap.add(1);
@@ -1540,47 +1572,56 @@ TEST(BitmapValueTest, bitmap_single_convert) {
 
     bitmap |= bitmap_u;
     EXPECT_EQ(BitmapValue::BITMAP, bitmap._type);
+
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, bitmap_value_iterator_test) {
-    BitmapValue empty;
-    for (auto iter = empty.begin(); iter != empty.end(); ++iter) {
-        // should not goes here
-        EXPECT_TRUE(false);
-    }
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    for (bool enable_set : {false, true}) {
+        config::enable_set_in_bitmap_value = enable_set;
 
-    BitmapValue single(1024);
-    auto single_iter = single.begin();
-    EXPECT_EQ(1024, *single_iter);
-    EXPECT_TRUE(single_iter == BitmapValue {1024}.begin());
-    EXPECT_TRUE(single_iter != single.end());
-
-    ++single_iter;
-    EXPECT_TRUE(single_iter == single.end());
-
-    int i = 0;
-    BitmapValue bitmap({0, 1025, 1026, UINT32_MAX, UINT64_MAX});
-    for (auto iter = bitmap.begin(); iter != bitmap.end(); ++iter, ++i) {
-        switch (i) {
-        case 0:
-            EXPECT_EQ(0, *iter);
-            break;
-        case 1:
-            EXPECT_EQ(1025, *iter);
-            break;
-        case 2:
-            EXPECT_EQ(1026, *iter);
-            break;
-        case 3:
-            EXPECT_EQ(UINT32_MAX, *iter);
-            break;
-        case 4:
-            EXPECT_EQ(UINT64_MAX, *iter);
-            break;
-        default:
+        BitmapValue empty;
+        for (auto iter = empty.begin(); iter != empty.end(); ++iter) {
+            // should not goes here
             EXPECT_TRUE(false);
         }
+
+        BitmapValue single(1024);
+        auto single_iter = single.begin();
+        EXPECT_EQ(1024, *single_iter);
+        EXPECT_TRUE(single_iter == BitmapValue {1024}.begin());
+        EXPECT_TRUE(single_iter != single.end());
+
+        ++single_iter;
+        EXPECT_TRUE(single_iter == single.end());
+
+        int i = 0;
+        BitmapValue bitmap({0, 1025, 1026, UINT32_MAX, UINT64_MAX});
+        EXPECT_EQ(enable_set ? BitmapValue::SET : BitmapValue::BITMAP, 
bitmap._type);
+        for (auto iter = bitmap.begin(); iter != bitmap.end(); ++iter, ++i) {
+            switch (i) {
+            case 0:
+                EXPECT_EQ(0, *iter);
+                break;
+            case 1:
+                EXPECT_EQ(1025, *iter);
+                break;
+            case 2:
+                EXPECT_EQ(1026, *iter);
+                break;
+            case 3:
+                EXPECT_EQ(UINT32_MAX, *iter);
+                break;
+            case 4:
+                EXPECT_EQ(UINT64_MAX, *iter);
+                break;
+            default:
+                EXPECT_TRUE(false);
+            }
+        }
     }
+    config::enable_set_in_bitmap_value = old_enable_set;
 }
 
 TEST(BitmapValueTest, contains_all_ignore_internal_representation) {
diff --git a/be/test/exprs/function/function_bitmap_test.cpp 
b/be/test/exprs/function/function_bitmap_test.cpp
index aba66d453ba..e58a3088b00 100644
--- a/be/test/exprs/function/function_bitmap_test.cpp
+++ b/be/test/exprs/function/function_bitmap_test.cpp
@@ -108,20 +108,14 @@ std::string encode_bitmap_to_base64(const BitmapValue& 
bitmap) {
 }
 
 TEST(function_bitmap_test, function_bitmap_to_base64) {
-    config::Register::Field field("bool", "enable_set_in_bitmap_value",
-                                  &config::enable_set_in_bitmap_value, 
"false", false);
-    config::Register::_s_field_map->insert(
-            std::make_pair(std::string("enable_set_in_bitmap_value"), field));
-
-    config::Register::Field field_ser_ver("int16_t", 
"bitmap_serialize_version",
-                                          &config::bitmap_serialize_version, 
"1", false);
-    config::Register::_s_field_map->insert(
-            std::make_pair(std::string("bitmap_serialize_version"), 
field_ser_ver));
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    const auto old_serialize_version = config::bitmap_serialize_version;
 
     std::string func_name = "bitmap_to_base64";
     InputTypeSet input_types = {PrimitiveType::TYPE_BITMAP};
 
-    EXPECT_TRUE(config::set_config("enable_set_in_bitmap_value", "false", 
false, true).ok());
+    config::enable_set_in_bitmap_value = false;
+    config::bitmap_serialize_version = 1;
     std::vector<uint64_t> bits32 {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 
11,
                                   12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 
23,
                                   24, 25, 26, 27, 28, 29, 30, 31, 32}; // 
SET_TYPE_THRESHOLD + 1
@@ -164,7 +158,7 @@ TEST(function_bitmap_test, function_bitmap_to_base64) {
         static_cast<void>(check_function<DataTypeString, true>(func_name, 
input_types, data_set));
     }
 
-    EXPECT_TRUE(config::set_config("enable_set_in_bitmap_value", "true", 
false, true).ok());
+    config::enable_set_in_bitmap_value = true;
     bitmap32_1 = BitmapValue(1);            // single
     bitmap32_2 = BitmapValue({1, 9999999}); // set
     bitmap32_3 = BitmapValue(bits32);       // bitmap
@@ -213,7 +207,7 @@ TEST(function_bitmap_test, function_bitmap_to_base64) {
     }
 
     // test bitmap serialize version2
-    EXPECT_TRUE(config::set_config("bitmap_serialize_version", "2", false, 
true).ok());
+    config::bitmap_serialize_version = 2;
     bitmap32_3 = BitmapValue(bits32); // bitmap32
     bitmap64_3 = BitmapValue(bits64); // bitmap64
     EXPECT_EQ(bitmap32_3.get_type_code(), BitmapTypeCode::BITMAP32_V2);
@@ -226,23 +220,19 @@ TEST(function_bitmap_test, function_bitmap_to_base64) {
 
         static_cast<void>(check_function<DataTypeString, true>(func_name, 
input_types, data_set));
     }
+
+    config::enable_set_in_bitmap_value = old_enable_set;
+    config::bitmap_serialize_version = old_serialize_version;
 }
 
 TEST(function_bitmap_test, function_bitmap_from_base64) {
-    config::Register::Field field("bool", "enable_set_in_bitmap_value",
-                                  &config::enable_set_in_bitmap_value, 
"false", false);
-    config::Register::_s_field_map->insert(
-            std::make_pair(std::string("enable_set_in_bitmap_value"), field));
-
-    config::Register::Field field_ser_ver("int16_t", 
"bitmap_serialize_version",
-                                          &config::bitmap_serialize_version, 
"1", false);
-    config::Register::_s_field_map->insert(
-            std::make_pair(std::string("bitmap_serialize_version"), 
field_ser_ver));
+    const auto old_enable_set = config::enable_set_in_bitmap_value;
+    const auto old_serialize_version = config::bitmap_serialize_version;
 
     std::string func_name = "bitmap_from_base64";
     InputTypeSet input_types = {PrimitiveType::TYPE_VARCHAR};
 
-    EXPECT_TRUE(config::set_config("enable_set_in_bitmap_value", "false", 
false, true).ok());
+    config::enable_set_in_bitmap_value = false;
     std::string bitmap32_base64_1("AQEAAAA=");
     std::string bitmap32_base64_2("AjowAAACAAAAAAAAAJgAAAAYAAAAGgAAAAEAf5Y=");
     std::string bitmap32_base64_3("AjswAAABAAAgAAEAAAAgAA==");
@@ -279,7 +269,7 @@ TEST(function_bitmap_test, function_bitmap_from_base64) {
         static_cast<void>(check_function<DataTypeBitMap, true>(func_name, 
input_types, data_set));
     }
 
-    EXPECT_TRUE(config::set_config("enable_set_in_bitmap_value", "true", 
false, true).ok());
+    config::enable_set_in_bitmap_value = true;
     bitmap32_base64_1 = ("AQEAAAA=");
     bitmap32_base64_2 = ("BQIBAAAAAAAAAH+WmAAAAAAA");
     bitmap32_base64_3 = ("AjswAAABAAAgAAEAAAAgAA==");
@@ -315,7 +305,7 @@ TEST(function_bitmap_test, function_bitmap_from_base64) {
         static_cast<void>(check_function<DataTypeBitMap, true>(func_name, 
input_types, data_set));
     }
     {
-        EXPECT_TRUE(config::set_config("bitmap_serialize_version", "1", false, 
true).ok());
+        config::bitmap_serialize_version = 1;
 
         std::string base64_32_v1(
                 
"AjowAAABAAAAAAAgABAAAAAAAAEAAgADAAQABQAGAAcACAAJAAoACwAMAA0ADgAPABAAEQASABMAFAAVAB"
@@ -327,7 +317,7 @@ TEST(function_bitmap_test, function_bitmap_from_base64) {
         static_cast<void>(check_function<DataTypeBitMap, true>(func_name, 
input_types, data_set));
     }
     {
-        EXPECT_TRUE(config::set_config("bitmap_serialize_version", "2", false, 
true).ok());
+        config::bitmap_serialize_version = 2;
 
         std::string base64_32_v2(
                 
"DAI6MAAAAQAAAAAAIAAQAAAAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQ"
@@ -338,6 +328,9 @@ TEST(function_bitmap_test, function_bitmap_from_base64) {
         DataSet data_set = {{{base64_32_v2}, &bitmap32_3}, {{base64_64_v2}, 
&bitmap64_3}};
         static_cast<void>(check_function<DataTypeBitMap, true>(func_name, 
input_types, data_set));
     }
+
+    config::enable_set_in_bitmap_value = old_enable_set;
+    config::bitmap_serialize_version = old_serialize_version;
 }
 
 TEST(function_bitmap_test, function_bitmap_and_count) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to