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

morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new b75533e72b3 [branch-2.1](beut) fix BE UT (#36147)
b75533e72b3 is described below

commit b75533e72b3e256281784a19d895de82dbbf50c2
Author: Mingyu Chen <[email protected]>
AuthorDate: Wed Jun 12 08:21:38 2024 +0800

    [branch-2.1](beut) fix BE UT (#36147)
    
    only for branch-2.1
---
 be/test/olap/segment_cache_test.cpp            |  6 +++---
 be/test/olap/single_compaction_test.cpp        |  8 +++-----
 be/test/vec/exec/delta_writer_v2_pool_test.cpp | 18 ++++++++++++------
 be/test/vec/function/function_string_test.cpp  |  4 ++--
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/be/test/olap/segment_cache_test.cpp 
b/be/test/olap/segment_cache_test.cpp
index a34f20d8c1b..157581f4a64 100644
--- a/be/test/olap/segment_cache_test.cpp
+++ b/be/test/olap/segment_cache_test.cpp
@@ -81,9 +81,8 @@ static void set_up() {
 
     doris::EngineOptions options;
     options.store_paths = paths;
-    auto engine = std::make_unique<StorageEngine>(options);
-    engine_ref = engine.get();
-    Status s = engine->open();
+    engine_ref = new StorageEngine(options);
+    Status s = engine_ref->open();
     ASSERT_TRUE(s.ok()) << s;
     ASSERT_TRUE(s.ok()) << s;
 
@@ -95,6 +94,7 @@ static void set_up() {
 static void tear_down() {
     ExecEnv* exec_env = doris::ExecEnv::GetInstance();
     exec_env->set_memtable_memory_limiter(nullptr);
+    delete engine_ref;
     engine_ref = nullptr;
     exec_env->set_storage_engine(nullptr);
     EXPECT_EQ(system("rm -rf ./segment_cache_test"), 0);
diff --git a/be/test/olap/single_compaction_test.cpp 
b/be/test/olap/single_compaction_test.cpp
index d909a6668be..a1d5a622d10 100644
--- a/be/test/olap/single_compaction_test.cpp
+++ b/be/test/olap/single_compaction_test.cpp
@@ -44,7 +44,7 @@ protected:
     void SetUp() override {
         const std::string dir_path = "ut_dir/single_compact_test";
         _engine = new StorageEngine({});
-        _data_dir = new DataDir(*_engine, dir_path);
+        _data_dir = new DataDir(dir_path);
         engine_ref = _engine;
     }
 
@@ -80,8 +80,7 @@ private:
 TEST_F(SingleCompactionTest, test_single) {
     TabletSharedPtr tablet = create_tablet(10001);
 
-    SingleReplicaCompaction single_compaction(*engine_ref, tablet,
-                                              
CompactionType::CUMULATIVE_COMPACTION);
+    SingleReplicaCompaction single_compaction(tablet, 
CompactionType::CUMULATIVE_COMPACTION);
     auto st = tablet->init();
     ASSERT_TRUE(st.ok()) << st;
     // load 30 rowsets
@@ -119,8 +118,7 @@ TEST_F(SingleCompactionTest, test_single) {
 TEST_F(SingleCompactionTest, test_unmatch) {
     TabletSharedPtr tablet = create_tablet(10000);
 
-    SingleReplicaCompaction single_compaction(*engine_ref, tablet,
-                                              
CompactionType::CUMULATIVE_COMPACTION);
+    SingleReplicaCompaction single_compaction(tablet, 
CompactionType::CUMULATIVE_COMPACTION);
     auto st = tablet->init();
     ASSERT_TRUE(st.ok()) << st;
     // local rowset [4-6]
diff --git a/be/test/vec/exec/delta_writer_v2_pool_test.cpp 
b/be/test/vec/exec/delta_writer_v2_pool_test.cpp
index a40724cf9ff..a67a701c409 100644
--- a/be/test/vec/exec/delta_writer_v2_pool_test.cpp
+++ b/be/test/vec/exec/delta_writer_v2_pool_test.cpp
@@ -57,12 +57,18 @@ TEST_F(DeltaWriterV2PoolTest, test_map) {
     EXPECT_EQ(1, pool.size());
     WriteRequest req;
     RuntimeState state;
-    auto writer = map->get_or_create(
-            100, [&req, &state]() { return DeltaWriterV2::open(&req, {}, 
&state); });
-    auto writer2 = map->get_or_create(
-            101, [&req, &state]() { return DeltaWriterV2::open(&req, {}, 
&state); });
-    auto writer3 = map->get_or_create(
-            100, [&req, &state]() { return DeltaWriterV2::open(&req, {}, 
&state); });
+    auto writer = map->get_or_create(100, [&req, &state]() {
+        return std::make_unique<DeltaWriterV2>(
+                &req, std::vector<std::shared_ptr<LoadStreamStub>> {}, &state);
+    });
+    auto writer2 = map->get_or_create(101, [&req, &state]() {
+        return std::make_unique<DeltaWriterV2>(
+                &req, std::vector<std::shared_ptr<LoadStreamStub>> {}, &state);
+    });
+    auto writer3 = map->get_or_create(100, [&req, &state]() {
+        return std::make_unique<DeltaWriterV2>(
+                &req, std::vector<std::shared_ptr<LoadStreamStub>> {}, &state);
+    });
     EXPECT_EQ(2, map->size());
     EXPECT_EQ(writer, writer3);
     EXPECT_NE(writer, writer2);
diff --git a/be/test/vec/function/function_string_test.cpp 
b/be/test/vec/function/function_string_test.cpp
index 6e3c2bba957..0e5d0e1e038 100644
--- a/be/test/vec/function/function_string_test.cpp
+++ b/be/test/vec/function/function_string_test.cpp
@@ -283,7 +283,7 @@ TEST(function_string_test, function_lpad_test) {
                         {{std::string("hi"), 0, std::string("?")}, 
std::string("")},
                         {{std::string("hi"), -1, std::string("?")}, Null()},
                         {{std::string("h"), 1, std::string("")}, 
std::string("h")},
-                        {{std::string("hi"), 5, std::string("")}, Null()},
+                        {{std::string("hi"), 5, std::string("")}, 
std::string("")},
                         {{std::string("hi"), 5, std::string("ab")}, 
std::string("abahi")},
                         {{std::string("hi"), 5, std::string("呵呵")}, 
std::string("呵呵呵hi")},
                         {{std::string("呵呵"), 5, std::string("hi")}, 
std::string("hih呵呵")}};
@@ -304,7 +304,7 @@ TEST(function_string_test, function_rpad_test) {
                         {{std::string("hi"), 0, std::string("?")}, 
std::string("")},
                         {{std::string("hi"), -1, std::string("?")}, Null()},
                         {{std::string("h"), 1, std::string("")}, 
std::string("h")},
-                        {{std::string("hi"), 5, std::string("")}, Null()},
+                        {{std::string("hi"), 5, std::string("")}, 
std::string("")},
                         {{std::string("hi"), 5, std::string("ab")}, 
std::string("hiaba")},
                         {{std::string("hi"), 5, std::string("呵呵")}, 
std::string("hi呵呵呵")},
                         {{std::string("呵呵"), 5, std::string("hi")}, 
std::string("呵呵hih")}};


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

Reply via email to