zclllyybb commented on code in PR #56798:
URL: https://github.com/apache/doris/pull/56798#discussion_r2422620541


##########
be/src/vec/functions/function_string.h:
##########
@@ -5097,6 +5097,110 @@ class FunctionMakeSet : public IFunction {
     }
 };
 
+class FunctionExportSet : public IFunction {
+public:
+    static constexpr auto name = "export_set";
+    static FunctionPtr create() { return 
std::make_shared<FunctionExportSet>(); }
+    String get_name() const override { return name; }
+    size_t get_number_of_arguments() const override { return 0; }
+    bool is_variadic() const override { return true; }
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        return std::make_shared<DataTypeString>();
+    }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
+                        uint32_t result, size_t input_rows_count) const 
override {
+        auto res_col = ColumnString::create();
+
+        const size_t arg_size = arguments.size();
+        std::vector<ColumnPtr> arg_col(arg_size);
+        std::vector<uint8_t> is_const(arg_size);
+        for (size_t i = 0; i < arg_size; ++i) {
+            std::tie(arg_col[i], is_const[i]) =
+                    
unpack_if_const(block.get_by_position(arguments[i]).column);
+        }
+
+        const auto& bit_col = assert_cast<const ColumnInt128&>(*arg_col[0]);
+        const auto& on_col = assert_cast<const ColumnString&>(*arg_col[1]);
+        const auto& off_col = assert_cast<const ColumnString&>(*arg_col[2]);
+
+        const ColumnString* separator_col = nullptr;
+        const ColumnInt32* num_bits_col = nullptr;
+        if (arg_size > 3) {
+            separator_col = &assert_cast<const ColumnString&>(*arg_col[3]);
+            if (arg_size == 5) {
+                num_bits_col = &assert_cast<const ColumnInt32&>(*arg_col[4]);
+            }
+        }
+
+        for (size_t i = 0; i < input_rows_count; ++i) {
+            const auto bit_value = bit_col.get_element(index_check_const(i, 
is_const[0]));

Review Comment:
   
测试一下性能,看是现在这样每个列都unpack_if_const然后index_check_const好,还是用default_parameter把除了第一列之后的都处理了好。



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