This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 71ad4bd747b [refine](BufferReadable) Turn read_binary_into into a
member function of BufferReadable (#53996)
71ad4bd747b is described below
commit 71ad4bd747b480f3f30e6de6637b7a3cdcbda142
Author: Mryange <[email protected]>
AuthorDate: Fri Aug 1 17:32:03 2025 +0800
[refine](BufferReadable) Turn read_binary_into into a member function of
BufferReadable (#53996)
---
.../aggregate_function_group_array_intersect.h | 2 +-
be/src/vec/common/string_buffer.hpp | 23 +++++++++++-----------
be/test/vec/common/string_buffer_test.cpp | 2 +-
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git
a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
index 6b12ed07f13..773d3dc59e1 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h
@@ -480,7 +480,7 @@ public:
StringRef element;
for (UInt64 i = 0; i < size; ++i) {
- element = read_binary_into(arena, buf);
+ element = buf.read_binary_into(arena);
data.value->insert((void*)element.data, element.size);
}
}
diff --git a/be/src/vec/common/string_buffer.hpp
b/be/src/vec/common/string_buffer.hpp
index 4e3f53b9d53..33a8397f610 100644
--- a/be/src/vec/common/string_buffer.hpp
+++ b/be/src/vec/common/string_buffer.hpp
@@ -291,22 +291,21 @@ public:
s = read(size);
}
+ ///TODO: Currently this function is only called in one place, we might
need to convert all read_binary(StringRef) to this style? Or directly use
read_binary(String)
+ StringRef read_binary_into(Arena& arena) {
+ UInt64 size = 0;
+ read_var_uint(size);
+
+ char* data = arena.alloc(size);
+ read(data, size);
+
+ return {data, size};
+ }
+
private:
const char* _data;
};
using VectorBufferReader = BufferReadable;
using BufferReader = BufferReadable;
-
-///TODO: Currently this function is only called in one place, we might need to
convert all read_binary(StringRef) to this style? Or directly use
read_binary(String)
-inline StringRef read_binary_into(Arena& arena, BufferReadable& buf) {
- UInt64 size = 0;
- buf.read_var_uint(size);
-
- char* data = arena.alloc(size);
- buf.read(data, size);
-
- return {data, size};
-}
-
} // namespace doris::vectorized
diff --git a/be/test/vec/common/string_buffer_test.cpp
b/be/test/vec/common/string_buffer_test.cpp
index 3f57e6e03b8..3e6ac1ba772 100644
--- a/be/test/vec/common/string_buffer_test.cpp
+++ b/be/test/vec/common/string_buffer_test.cpp
@@ -187,7 +187,7 @@ TEST(StringBufferTest, ReadWriteStringRefWithArena) {
StringRef sr = column->get_data_at(0);
BufferReadable reader(sr);
- StringRef new_str_ref = read_binary_into(arena, reader);
+ StringRef new_str_ref = reader.read_binary_into(arena);
ASSERT_EQ(original_str_ref.size, new_str_ref.size);
ASSERT_EQ(original_str_ref.to_string(), new_str_ref.to_string());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]