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


##########
be/src/olap/types.h:
##########
@@ -957,6 +969,103 @@ struct 
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_LARGEINT>
     }
 };
 
+template <>
+struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4>
+        : public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4> {
+    static Status from_string(void* buf, const std::string& scan_key, const 
int precision,
+                              const int scale) {
+        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
+        uint32_t value = 
StringParser::string_to_unsigned_int<uint32_t>(scan_key.c_str(), 
scan_key.size(), &result);
+
+        if (result == StringParser::PARSE_FAILURE) {
+            return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                    "FieldTypeTraits<OLAP_FIELD_TYPE_IPV4>::from_string meet 
PARSE_FAILURE");
+        }
+        *reinterpret_cast<uint32_t*>(buf) = value;
+        return Status::OK();
+    }
+
+    static std::string to_string(const void* src) {
+        uint32_t value = *reinterpret_cast<const uint32_t*>(src);
+        std::stringstream ss;

Review Comment:
   warning: variable 'ss' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
           std::stringstream ss = 0;
   ```
   



##########
be/src/olap/types.h:
##########
@@ -957,6 +969,103 @@ struct 
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_LARGEINT>
     }
 };
 
+template <>
+struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4>
+        : public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4> {
+    static Status from_string(void* buf, const std::string& scan_key, const 
int precision,
+                              const int scale) {
+        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
+        uint32_t value = 
StringParser::string_to_unsigned_int<uint32_t>(scan_key.c_str(), 
scan_key.size(), &result);
+
+        if (result == StringParser::PARSE_FAILURE) {
+            return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                    "FieldTypeTraits<OLAP_FIELD_TYPE_IPV4>::from_string meet 
PARSE_FAILURE");
+        }
+        *reinterpret_cast<uint32_t*>(buf) = value;
+        return Status::OK();
+    }
+
+    static std::string to_string(const void* src) {
+        uint32_t value = *reinterpret_cast<const uint32_t*>(src);
+        std::stringstream ss;
+        ss << ((value >> 24) & 0xFF) << '.'
+           << ((value >> 16) & 0xFF) << '.'
+           << ((value >> 8) & 0xFF) << '.'
+           << (value & 0xFF);
+        return ss.str();
+    }
+};
+
+
+template <>
+struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV6>
+        : public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_IPV6> {
+    static Status from_string(void* buf, const std::string& scan_key, const 
int precision,
+                              const int scale) {
+        std::istringstream iss(scan_key);
+        std::string token = 0;

Review Comment:
   warning: variable 'token' is not initialized 
[cppcoreguidelines-init-variables]
   
   ```suggestion
           std::string token = 0 = 0;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }
+
+    bool equals(const IDataType& rhs) const override;
+    std::string to_string(const IColumn& column, size_t row_num) const 
override;
+    void to_string(const IColumn& column, size_t row_num, BufferWritable& 
ostr) const override;
+    Status from_string(ReadBuffer& rb, IColumn* column) const override;
+
+    static std::string convert_ipv4_to_string(IPv4 ipv4);
+    static bool convert_string_to_ipv4(IPv4& x, std::string ipv4);
+
+    Field get_field(const TExprNode& node) const override {

Review Comment:
   warning: function 'get_field' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] Field get_field(const TExprNode& node) const override {
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;

Review Comment:
   warning: variable 'ptr' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
       ColumnPtr ptr = 0 = result.first;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv4 value = assert_cast<const ColumnIPv4&>(*ptr).get_element(row_num);
+    return convert_ipv4_to_string(value);
+}
+
+void DataTypeIPv4::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv4::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv4*>(column);

Review Comment:
   warning: variable 'column_data' is not initialized 
[cppcoreguidelines-init-variables]
   
   ```suggestion
       auto* column_data = nullptr = static_cast<ColumnIPv4*>(column);
   ```
   



##########
be/src/olap/types.h:
##########
@@ -957,6 +969,103 @@ struct 
FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_LARGEINT>
     }
 };
 
+template <>
+struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4>
+        : public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_IPV4> {
+    static Status from_string(void* buf, const std::string& scan_key, const 
int precision,
+                              const int scale) {
+        StringParser::ParseResult result = StringParser::PARSE_SUCCESS;
+        uint32_t value = 
StringParser::string_to_unsigned_int<uint32_t>(scan_key.c_str(), 
scan_key.size(), &result);
+
+        if (result == StringParser::PARSE_FAILURE) {
+            return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                    "FieldTypeTraits<OLAP_FIELD_TYPE_IPV4>::from_string meet 
PARSE_FAILURE");
+        }
+        *reinterpret_cast<uint32_t*>(buf) = value;
+        return Status::OK();
+    }
+
+    static std::string to_string(const void* src) {
+        uint32_t value = *reinterpret_cast<const uint32_t*>(src);
+        std::stringstream ss;
+        ss << ((value >> 24) & 0xFF) << '.'
+           << ((value >> 16) & 0xFF) << '.'
+           << ((value >> 8) & 0xFF) << '.'
+           << (value & 0xFF);
+        return ss.str();
+    }
+};
+
+
+template <>
+struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_IPV6>
+        : public BaseFieldtypeTraits<FieldType::OLAP_FIELD_TYPE_IPV6> {
+    static Status from_string(void* buf, const std::string& scan_key, const 
int precision,
+                              const int scale) {
+        std::istringstream iss(scan_key);
+        std::string token = 0;
+        uint128_t result = 0;
+        int count = 0;
+
+        while (std::getline(iss, token, ':')) {
+            if (token.empty()) {
+                count += 8 - count;
+                break;
+            }
+
+            if (count > 8) {
+                return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                        "FieldTypeTraits<OLAP_FIELD_TYPE_IPV6>::from_string 
meet PARSE_FAILURE");
+            }
+
+            uint16_t value = 0;
+            std::istringstream ss(token);
+            if (!(ss >> std::hex >> value)) {
+                return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                        "FieldTypeTraits<OLAP_FIELD_TYPE_IPV6>::from_string 
meet PARSE_FAILURE");
+            }
+
+            result = (result << 16) | value;
+            count++;
+        }
+
+        if (count < 8) {
+            return Status::Error<ErrorCode::INVALID_ARGUMENT>(
+                    "FieldTypeTraits<OLAP_FIELD_TYPE_IPV6>::from_string meet 
PARSE_FAILURE");
+        }
+
+        *reinterpret_cast<uint128_t*>(buf) = result;
+        return Status::OK();
+    }
+
+    static std::string to_string(const void* src) {
+        std::stringstream result;

Review Comment:
   warning: variable 'result' is not initialized 
[cppcoreguidelines-init-variables]
   
   ```suggestion
           std::stringstream result = 0;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv4 value = assert_cast<const ColumnIPv4&>(*ptr).get_element(row_num);
+    return convert_ipv4_to_string(value);
+}
+
+void DataTypeIPv4::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv4::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv4*>(column);
+    StringParser::ParseResult result;

Review Comment:
   warning: variable 'result' is not initialized 
[cppcoreguidelines-init-variables]
   ```cpp
       StringParser::ParseResult result;
                                 ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv4 value = assert_cast<const ColumnIPv4&>(*ptr).get_element(row_num);
+    return convert_ipv4_to_string(value);
+}
+
+void DataTypeIPv4::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv4::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv4*>(column);
+    StringParser::ParseResult result;
+    IPv4 val = StringParser::string_to_unsigned_int<IPv4>(rb.position(), 
rb.count(), &result);
+    column_data->insert_value(val);
+    return Status::OK();
+}
+
+std::string DataTypeIPv4::convert_ipv4_to_string(IPv4 ipv4) {
+    std::stringstream ss;

Review Comment:
   warning: variable 'ss' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
       std::stringstream ss = 0;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>

Review Comment:
   warning: 'gen_cpp/Types_types.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/Types_types.h>
            ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv4 value = assert_cast<const ColumnIPv4&>(*ptr).get_element(row_num);
+    return convert_ipv4_to_string(value);
+}
+
+void DataTypeIPv4::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv4::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv4*>(column);
+    StringParser::ParseResult result;
+    IPv4 val = StringParser::string_to_unsigned_int<IPv4>(rb.position(), 
rb.count(), &result);
+    column_data->insert_value(val);
+    return Status::OK();
+}
+
+std::string DataTypeIPv4::convert_ipv4_to_string(IPv4 ipv4) {
+    std::stringstream ss;
+    ss << ((ipv4 >> 24) & 0xFF) << '.'
+       << ((ipv4 >> 16) & 0xFF) << '.'
+       << ((ipv4 >> 8) & 0xFF) << '.'
+       << (ipv4 & 0xFF);
+    return ss.str();
+}
+
+bool DataTypeIPv4::convert_string_to_ipv4(IPv4& x, std::string ipv4) {
+    const static int IPV4_PARTS_NUM = 4;
+    IPv4 parts[IPV4_PARTS_NUM];
+    int part_index = 0;
+    std::stringstream ss(ipv4);
+    std::string part;

Review Comment:
   warning: variable 'part' is not initialized 
[cppcoreguidelines-init-variables]
   
   ```suggestion
       std::string part = 0;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.cpp:
##########
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv4.h"
+
+
+#include "util/binary_cast.hpp"
+#include "util/string_parser.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv4::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv4::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv4 value = assert_cast<const ColumnIPv4&>(*ptr).get_element(row_num);
+    return convert_ipv4_to_string(value);
+}
+
+void DataTypeIPv4::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv4::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv4*>(column);
+    StringParser::ParseResult result;
+    IPv4 val = StringParser::string_to_unsigned_int<IPv4>(rb.position(), 
rb.count(), &result);
+    column_data->insert_value(val);
+    return Status::OK();
+}
+
+std::string DataTypeIPv4::convert_ipv4_to_string(IPv4 ipv4) {
+    std::stringstream ss;
+    ss << ((ipv4 >> 24) & 0xFF) << '.'
+       << ((ipv4 >> 16) & 0xFF) << '.'
+       << ((ipv4 >> 8) & 0xFF) << '.'
+       << (ipv4 & 0xFF);
+    return ss.str();
+}
+
+bool DataTypeIPv4::convert_string_to_ipv4(IPv4& x, std::string ipv4) {
+    const static int IPV4_PARTS_NUM = 4;
+    IPv4 parts[IPV4_PARTS_NUM];
+    int part_index = 0;
+    std::stringstream ss(ipv4);
+    std::string part;
+    StringParser::ParseResult result;

Review Comment:
   warning: variable 'result' is not initialized 
[cppcoreguidelines-init-variables]
   ```cpp
       StringParser::ParseResult result;
                                 ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }

Review Comment:
   warning: function 'get_type_as_primitive_type' should be marked 
[[nodiscard]] [modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] PrimitiveType get_type_as_primitive_type() const override 
{ return TYPE_IPV4; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }

Review Comment:
   warning: function 'get_family_name' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] const char* get_family_name() const override { return 
"IPv4"; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {

Review Comment:
   warning: function 'get_type_as_tprimitive_type' should be marked 
[[nodiscard]] [modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] TPrimitiveType::type get_type_as_tprimitive_type() const 
override {
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }

Review Comment:
   warning: function 'get_type_id' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] TypeIndex get_type_id() const override { return 
TypeIndex::IPv4; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }
+
+    bool equals(const IDataType& rhs) const override;

Review Comment:
   warning: function 'equals' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] bool equals(const IDataType& rhs) const override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }
+
+    bool equals(const IDataType& rhs) const override;
+    std::string to_string(const IColumn& column, size_t row_num) const 
override;

Review Comment:
   warning: function 'to_string' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::string to_string(const IColumn& column, size_t 
row_num) const override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }

Review Comment:
   warning: function 'can_be_inside_nullable' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] bool can_be_inside_nullable() const override { return 
true; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.cpp:
##########
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv6.h"
+
+
+#include "util/binary_cast.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+#include "vec/runtime/ipv6_value.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv6::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv6::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;

Review Comment:
   warning: variable 'ptr' is not initialized [cppcoreguidelines-init-variables]
   
   ```suggestion
       ColumnPtr ptr = 0 = result.first;
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,87 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_ipv4.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv6_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv6 final : public DataTypeNumberBase<IPv6> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv6; }

Review Comment:
   warning: function 'get_type_id' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] TypeIndex get_type_id() const override { return 
TypeIndex::IPv6; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }
+
+    bool equals(const IDataType& rhs) const override;
+    std::string to_string(const IColumn& column, size_t row_num) const 
override;
+    void to_string(const IColumn& column, size_t row_num, BufferWritable& 
ostr) const override;
+    Status from_string(ReadBuffer& rb, IColumn* column) const override;
+
+    static std::string convert_ipv4_to_string(IPv4 ipv4);
+    static bool convert_string_to_ipv4(IPv4& x, std::string ipv4);
+
+    Field get_field(const TExprNode& node) const override {
+        return (IPv4) node.ipv4_literal.value;
+    }
+
+    MutableColumnPtr create_column() const override;
+
+    DataTypeSerDeSPtr get_serde() const override { return 
std::make_shared<DataTypeIPv4SerDe>(); }

Review Comment:
   warning: function 'get_serde' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] DataTypeSerDeSPtr get_serde() const override { return 
std::make_shared<DataTypeIPv4SerDe>(); }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }

Review Comment:
   warning: function 'do_get_name' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] std::string do_get_name() const override { return "IPv4"; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+#include <stddef.h>
+
+#include <algorithm>
+#include <boost/iterator/iterator_facade.hpp>
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+#include "vec/data_types/serde/data_type_ipv4_serde.h"
+
+namespace doris {
+namespace vectorized {
+class BufferWritable;
+class ReadBuffer;
+class IColumn;
+} // namespace vectorized
+} // namespace doris
+
+namespace doris::vectorized {
+
+class DataTypeIPv4 final : public DataTypeNumberBase<IPv4> {
+public:
+    TypeIndex get_type_id() const override { return TypeIndex::IPv4; }
+    PrimitiveType get_type_as_primitive_type() const override { return 
TYPE_IPV4; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }
+    std::string do_get_name() const override { return "IPv4"; }
+
+    bool can_be_inside_nullable() const override { return true; }
+
+    bool equals(const IDataType& rhs) const override;
+    std::string to_string(const IColumn& column, size_t row_num) const 
override;
+    void to_string(const IColumn& column, size_t row_num, BufferWritable& 
ostr) const override;
+    Status from_string(ReadBuffer& rb, IColumn* column) const override;
+
+    static std::string convert_ipv4_to_string(IPv4 ipv4);
+    static bool convert_string_to_ipv4(IPv4& x, std::string ipv4);
+
+    Field get_field(const TExprNode& node) const override {
+        return (IPv4) node.ipv4_literal.value;
+    }
+
+    MutableColumnPtr create_column() const override;

Review Comment:
   warning: function 'create_column' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] MutableColumnPtr create_column() const override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,87 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>

Review Comment:
   warning: 'gen_cpp/Types_types.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/Types_types.h>
            ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.cpp:
##########
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/data_types/data_type_ipv6.h"
+
+
+#include "util/binary_cast.hpp"
+#include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/assert_cast.h"
+#include "vec/common/string_buffer.hpp"
+#include "vec/data_types/data_type.h"
+#include "vec/io/io_helper.h"
+#include "vec/io/reader_buffer.h"
+#include "vec/runtime/ipv6_value.h"
+
+namespace doris::vectorized {
+bool DataTypeIPv6::equals(const IDataType& rhs) const {
+    return typeid(rhs) == typeid(*this);
+}
+
+std::string DataTypeIPv6::to_string(const IColumn& column, size_t row_num) 
const {
+    auto result = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = result.first;
+    row_num = result.second;
+    IPv6 value = assert_cast<const ColumnIPv6&>(*ptr).get_element(row_num);
+    return convert_ipv6_to_string(value);
+}
+
+void DataTypeIPv6::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) const {
+    std::string value = to_string(column, row_num);
+    ostr.write(value.data(), value.size());
+}
+
+Status DataTypeIPv6::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto* column_data = static_cast<ColumnIPv6*>(column);

Review Comment:
   warning: variable 'column_data' is not initialized 
[cppcoreguidelines-init-variables]
   
   ```suggestion
       auto* column_data = nullptr = static_cast<ColumnIPv6*>(column);
   ```
   



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