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


##########
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);

Review Comment:
   warning: 0xFF is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
          << (ipv4 & 0xFF);
                     ^
   ```
   



##########
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) {

Review Comment:
   warning: method 'convert_string_to_ipv4' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static bool DataTypeIPv4::convert_string_to_ipv4(IPv4& x, std::string ipv4) {
   ```
   



##########
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;
+
+    while (std::getline(ss, part, '.')) {
+        IPv4 val = StringParser::string_to_unsigned_int<IPv4>(part.data(), 
part.size(), &result);
+        if (UNLIKELY(result != StringParser::PARSE_SUCCESS) || val > 255) {

Review Comment:
   warning: 255 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (UNLIKELY(result != StringParser::PARSE_SUCCESS) || val > 255) {
                                                                        ^
   ```
   



##########
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;
+
+    while (std::getline(ss, part, '.')) {
+        IPv4 val = StringParser::string_to_unsigned_int<IPv4>(part.data(), 
part.size(), &result);
+        if (UNLIKELY(result != StringParser::PARSE_SUCCESS) || val > 255) {
+            return false;
+        }
+        parts[part_index++] = val;
+    }
+
+    if (part_index != 4) {
+        return false;
+    }
+
+    x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];

Review Comment:
   warning: 24 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];
                        ^
   ```
   



##########
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];

Review Comment:
   warning: do not declare C-style arrays, use std::array<> instead 
[modernize-avoid-c-arrays]
   ```cpp
       IPv4 parts[IPV4_PARTS_NUM];
       ^
   ```
   



##########
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;
+
+    while (std::getline(ss, part, '.')) {
+        IPv4 val = StringParser::string_to_unsigned_int<IPv4>(part.data(), 
part.size(), &result);
+        if (UNLIKELY(result != StringParser::PARSE_SUCCESS) || val > 255) {
+            return false;
+        }
+        parts[part_index++] = val;
+    }
+
+    if (part_index != 4) {
+        return false;
+    }
+
+    x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];
                                                              ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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>

Review Comment:
   warning: inclusion of deprecated C++ header 'stddef.h'; consider using 
'cstddef' instead [modernize-deprecated-headers]
   
   ```suggestion
   #include <cstddef>
   ```
   



##########
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;
+
+    while (std::getline(ss, part, '.')) {
+        IPv4 val = StringParser::string_to_unsigned_int<IPv4>(part.data(), 
part.size(), &result);
+        if (UNLIKELY(result != StringParser::PARSE_SUCCESS) || val > 255) {
+            return false;
+        }
+        parts[part_index++] = val;
+    }
+
+    if (part_index != 4) {
+        return false;
+    }
+
+    x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];

Review Comment:
   warning: 16 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       x = (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3];
                                           ^
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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: method 'get_type_id' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static TypeIndex get_type_id() override { return TypeIndex::IPv4; }
   ```
   



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

Review Comment:
   warning: method 'to_string' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   void DataTypeIPv6::to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) {
   ```
   
   be/src/vec/data_types/data_type_ipv6.h:57:
   ```diff
   -     void to_string(const IColumn& column, size_t row_num, BufferWritable& 
ostr) const override;
   +     static void to_string(const IColumn& column, size_t row_num, 
BufferWritable& ostr) override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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 {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::vectorized {
   ```
   
   be/src/vec/data_types/data_type_ipv4.h:38:
   ```diff
   - } // namespace vectorized
   - } // namespace doris
   + } // namespace doris
   ```
   



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

Review Comment:
   warning: method 'from_string' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   Status DataTypeIPv6::from_string(ReadBuffer& rb, IColumn* column) {
   ```
   
   be/src/vec/data_types/data_type_ipv6.h:58:
   ```diff
   -     Status from_string(ReadBuffer& rb, IColumn* column) const override;
   +     static Status from_string(ReadBuffer& rb, IColumn* column) override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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; }
+    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: method 'can_be_inside_nullable' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static bool can_be_inside_nullable() override { return true; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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; }
+    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: method 'get_field' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Field get_field(const TExprNode& node) override {
   ```
   



##########
be/src/vec/data_types/data_type_ipv4.h:
##########
@@ -0,0 +1,77 @@
+// 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; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV4;
+    }
+    const char* get_family_name() const override { return "IPv4"; }

Review Comment:
   warning: method 'get_family_name' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static const char* get_family_name() override { return "IPv4"; }
   ```
   



##########
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);
+    IPv6 value;
+    if (!convert_string_to_ipv6(value, rb.to_string())) {
+        throw doris::Exception(doris::ErrorCode::INVALID_ARGUMENT,
+                               "Invalid value: {} for type IPv6", 
rb.to_string());
+    }
+    column_data->insert_value(value);
+    return Status::OK();
+}
+
+std::string DataTypeIPv6::convert_ipv6_to_string(IPv6 ipv6) {
+    return IPv6Value::to_string(ipv6);
+}
+
+bool DataTypeIPv6::convert_string_to_ipv6(IPv6& x, std::string ipv6) {

Review Comment:
   warning: method 'convert_string_to_ipv6' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static bool DataTypeIPv6::convert_string_to_ipv6(IPv6& x, std::string ipv6) {
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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 {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::vectorized {
   ```
   
   be/src/vec/data_types/data_type_ipv6.h:39:
   ```diff
   - } // namespace vectorized
   - } // namespace doris
   + } // namespace doris
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV6;
+    }
+    const char* get_family_name() const override { return "IPv6"; }
+    std::string do_get_name() const override { return "IPv6"; }
+
+    bool can_be_inside_nullable() const override { return true; }

Review Comment:
   warning: method 'can_be_inside_nullable' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static bool can_be_inside_nullable() override { return true; }
   ```
   



##########
be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:
##########
@@ -0,0 +1,51 @@
+// 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 "data_type_ipv4_serde.h"
+#include <arrow/builder.h>
+#include "vec/columns/column_const.h"
+
+namespace doris {
+namespace vectorized {
+
+template <bool is_binary_format>
+Status DataTypeIPv4SerDe::_write_column_to_mysql(const IColumn& column,
+                                                   
MysqlRowBuffer<is_binary_format>& result,
+                                                   int row_idx, bool 
col_const) const {
+    auto& data = assert_cast<const ColumnVector<IPv4>&>(column).get_data();
+    auto col_index = index_check_const(row_idx, col_const);
+    IPv4Value ipv4_val(data[col_index]);
+    if (UNLIKELY(0 != result.push_ipv4(ipv4_val))) {
+        return Status::InternalError("pack mysql buffer failed.");
+    }
+    return Status::OK();
+}
+
+Status DataTypeIPv4SerDe::write_column_to_mysql(const IColumn& column,

Review Comment:
   warning: method 'write_column_to_mysql' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:39:
   ```diff
   -                                                   bool col_const) const {
   +                                                   bool col_const) {
   ```
   
   be/src/vec/data_types/serde/data_type_ipv4_serde.h:41:
   ```diff
   -     Status write_column_to_mysql(const IColumn& column, 
MysqlRowBuffer<true>& row_buffer,
   -                                  int row_idx, bool col_const) const 
override;
   +     static Status write_column_to_mysql(const IColumn& column, 
MysqlRowBuffer<true>& row_buffer,
   +                                  int row_idx, bool col_const) override;
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV6;
+    }
+    const char* get_family_name() const override { return "IPv6"; }

Review Comment:
   warning: method 'get_family_name' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static const char* get_family_name() override { return "IPv6"; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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>

Review Comment:
   warning: inclusion of deprecated C++ header 'stddef.h'; consider using 
'cstddef' instead [modernize-deprecated-headers]
   
   ```suggestion
   #include <cstddef>
   ```
   



##########
be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:
##########
@@ -0,0 +1,51 @@
+// 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 "data_type_ipv4_serde.h"
+#include <arrow/builder.h>
+#include "vec/columns/column_const.h"
+
+namespace doris {
+namespace vectorized {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::vectorized {
   ```
   
   be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:49:
   ```diff
   - } // namespace vectorized
   - } // namespace doris
   + } // namespace doris
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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: method 'get_type_id' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static TypeIndex get_type_id() override { return TypeIndex::IPv6; }
   ```
   



##########
be/src/vec/data_types/data_type_ipv6.h:
##########
@@ -0,0 +1,86 @@
+// 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; }
+    TPrimitiveType::type get_type_as_tprimitive_type() const override {
+        return TPrimitiveType::IPV6;
+    }
+    const char* get_family_name() const override { return "IPv6"; }
+    std::string do_get_name() const override { return "IPv6"; }
+
+    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_ipv6_to_string(IPv6 ipv6);
+    static bool convert_string_to_ipv6(IPv6& x, std::string ipv6);
+
+    Field get_field(const TExprNode& node) const override {

Review Comment:
   warning: method 'get_field' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Field get_field(const TExprNode& node) override {
   ```
   



##########
be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:
##########
@@ -0,0 +1,51 @@
+// 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 "data_type_ipv4_serde.h"
+#include <arrow/builder.h>
+#include "vec/columns/column_const.h"
+
+namespace doris {
+namespace vectorized {
+
+template <bool is_binary_format>
+Status DataTypeIPv4SerDe::_write_column_to_mysql(const IColumn& column,
+                                                   
MysqlRowBuffer<is_binary_format>& result,
+                                                   int row_idx, bool 
col_const) const {
+    auto& data = assert_cast<const ColumnVector<IPv4>&>(column).get_data();
+    auto col_index = index_check_const(row_idx, col_const);
+    IPv4Value ipv4_val(data[col_index]);
+    if (UNLIKELY(0 != result.push_ipv4(ipv4_val))) {
+        return Status::InternalError("pack mysql buffer failed.");
+    }
+    return Status::OK();
+}
+
+Status DataTypeIPv4SerDe::write_column_to_mysql(const IColumn& column,
+                                                  MysqlRowBuffer<true>& 
row_buffer, int row_idx,
+                                                  bool col_const) const {
+    return _write_column_to_mysql(column, row_buffer, row_idx, col_const);
+}
+
+Status DataTypeIPv4SerDe::write_column_to_mysql(const IColumn& column,
+                                                  MysqlRowBuffer<false>& 
row_buffer, int row_idx,

Review Comment:
   warning: method 'write_column_to_mysql' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/vec/data_types/serde/data_type_ipv4_serde.cpp:45:
   ```diff
   -                                                   bool col_const) const {
   +                                                   bool col_const) {
   ```
   
   ```suggestion
       static Status write_column_to_mysql(const IColumn& column, 
MysqlRowBuffer<false>& row_buffer,
                                    int row_idx, bool col_const) 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: [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