github-actions[bot] commented on code in PR #29819:
URL: https://github.com/apache/doris/pull/29819#discussion_r1460303446


##########
be/src/vec/functions/function_ip.h:
##########
@@ -741,6 +752,129 @@ class FunctionIsIPAddressInRange : public IFunction {
     }
 };
 
+class FunctionIPv4CIDRToRange : public IFunction {
+public:
+    static constexpr auto name = "ipv4_cidr_to_range";
+    static FunctionPtr create() { return 
std::make_shared<FunctionIPv4CIDRToRange>(); }
+
+    String get_name() const override { return name; }
+
+    size_t get_number_of_arguments() const override { return 2; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {

Review Comment:
   warning: method 'get_return_type_impl' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static DataTypePtr get_return_type_impl(const DataTypes& arguments) 
override {
   ```
   



##########
be/src/vec/functions/function_ip.h:
##########
@@ -741,6 +752,129 @@
     }
 };
 
+class FunctionIPv4CIDRToRange : public IFunction {
+public:
+    static constexpr auto name = "ipv4_cidr_to_range";
+    static FunctionPtr create() { return 
std::make_shared<FunctionIPv4CIDRToRange>(); }
+
+    String get_name() const override { return name; }
+
+    size_t get_number_of_arguments() const override { return 2; }
+
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        WhichDataType first_arg_type = arguments[0];
+        if (!(first_arg_type.is_ipv4() || first_arg_type.is_native_int())) {
+            throw Exception(
+                    ErrorCode::INVALID_ARGUMENT,
+                    "Illegal type {} of first argument of function {}, 
expected IPv4 or Native Int",
+                    arguments[0]->get_name(), get_name());
+        }
+
+        WhichDataType second_arg_type = arguments[1];
+        if (!(second_arg_type.is_int16())) {
+            throw Exception(ErrorCode::INVALID_ARGUMENT,
+                            "Illegal type {} of second argument of function 
{}, expected Int16",
+                            arguments[1]->get_name(), get_name());
+        }
+
+        DataTypePtr element = std::make_shared<DataTypeIPv4>();
+
+        return std::make_shared<DataTypeStruct>(DataTypes {element, element},
+                                                Strings {"min", "max"});
+    }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
+                        size_t result, size_t input_rows_count) const override 
{

Review Comment:
   warning: method 'execute_impl' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
                           size_t result, size_t input_rows_count) override {
   ```
   



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