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


##########
be/src/vec/functions/function_string.h:
##########
@@ -5097,6 +5097,131 @@ 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();
+        bool col_const[5];
+        ColumnPtr arg_cols[5];
+        for (int i = 0; i < arg_size; ++i) {
+            col_const[i] = 
is_column_const(*block.get_by_position(arguments[i]).column);
+        }
+        arg_cols[0] = col_const[0] ? static_cast<const ColumnConst&>(
+                                             
*block.get_by_position(arguments[0]).column)
+                                             .convert_to_full_column()
+                                   : 
block.get_by_position(arguments[0]).column;
+        if (arg_size == 3) {
+            default_preprocess_parameter_columns(arg_cols, col_const, {1, 2}, 
block, arguments);
+        } else if (arg_size == 4) {
+            default_preprocess_parameter_columns(arg_cols, col_const, {1, 2, 
3}, block, arguments);
+        } else if (arg_size == 5) {
+            default_preprocess_parameter_columns(arg_cols, col_const, {1, 2, 
3, 4}, block,
+                                                 arguments);
+        }
+
+        const auto* bit_col = assert_cast<const 
ColumnInt128*>(arg_cols[0].get());
+        const auto* on_col = assert_cast<const 
ColumnString*>(arg_cols[1].get());
+        const auto* off_col = assert_cast<const 
ColumnString*>(arg_cols[2].get());
+        const ColumnString* sep_col = nullptr;
+        const ColumnInt32* num_bits_col = nullptr;
+        if (arg_size > 3) {
+            sep_col = assert_cast<const ColumnString*>(arg_cols[3].get());
+            if (arg_size == 5) {
+                num_bits_col = assert_cast<const 
ColumnInt32*>(arg_cols[4].get());
+            }
+        }
+
+        for (size_t i = 0; i < input_rows_count; ++i) {
+            uint64_t bit = check_and_get_bit(bit_col->get_element(i));
+            StringRef on = on_col->get_data_at(col_const[1] ? 0 : i);

Review Comment:
   wrong use after `default_preprocess_parameter_columns`



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