mrhhsg commented on code in PR #23759:
URL: https://github.com/apache/doris/pull/23759#discussion_r1312845545


##########
be/src/vec/functions/function_bitmap.cpp:
##########
@@ -887,6 +942,40 @@ struct BitmapToString {
     }
 };
 
+struct NameBitmapToBase64 {
+    static constexpr auto name = "bitmap_to_base64";
+};
+
+struct BitmapToBase64 {
+    using ReturnType = DataTypeString;
+    static constexpr auto TYPE_INDEX = TypeIndex::BitMap;
+    using Type = DataTypeBitMap::FieldType;
+    using ReturnColumnType = ColumnString;
+    using Chars = ColumnString::Chars;
+    using Offsets = ColumnString::Offsets;
+
+    static Status vector(const std::vector<BitmapValue>& data, Chars& chars, 
Offsets& offsets) {
+        size_t size = data.size();
+        offsets.resize(size);
+        chars.reserve(size);
+        for (size_t i = 0; i < size; ++i) {
+            BitmapValue& bitmap_val = const_cast<BitmapValue&>(data[i]);
+            auto ser_size = bitmap_val.getSizeInBytes();
+            char ser_buff[ser_size];

Review Comment:
   Better to allocate this buffer on the heap memory and outside of the loop, 
and reuse it.



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