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


##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |

Review Comment:
   warning: 48 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
                                                                ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |

Review Comment:
   warning: 32 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                           (static_cast<uint64_t>(fields[1]) << 32) |
                                                                ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);

Review Comment:
   warning: 16 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                           (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
                                                                ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |

Review Comment:
   warning: 5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                          (static_cast<uint64_t>(fields[5]) << 32) |
                                                        ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |

Review Comment:
   warning: 48 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
                                                               ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |

Review Comment:
   warning: 32 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                          (static_cast<uint64_t>(fields[5]) << 32) |
                                                               ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;

Review Comment:
   warning: 64 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           x = static_cast<vectorized::IPv6>(high) << 64 | low;
                                                      ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);

Review Comment:
   warning: 6 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                          (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
                                                        ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);

Review Comment:
   warning: 16 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                          (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
                                                               ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));

Review Comment:
   warning: 56 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
                                                                  ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);

Review Comment:
   warning: 7 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                          (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
                                                                                
                  ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
                                                                           ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);

Review Comment:
   warning: use auto when initializing with a cast to avoid duplicating the 
type name [modernize-use-auto]
   
   ```suggestion
           auto low = static_cast<uint64_t>(x);
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
                                                                                
^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);

Review Comment:
   warning: use auto when initializing with a cast to avoid duplicating the 
type name [modernize-use-auto]
   
   ```suggestion
           auto high = static_cast<uint64_t>(x >> 64);
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));

Review Comment:
   warning: 56 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
                                                                 ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;

Review Comment:
   warning: 64 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           x = static_cast<vectorized::IPv6>(high) << 64 | low;
                                                      ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
+                              static_cast<uint16_t>((high >> 32) & 0xFFFF),

Review Comment:
   warning: 0xFFFF is a magic number; consider replacing it with a named 
constant [readability-magic-numbers]
   ```cpp
                                 static_cast<uint16_t>((high >> 32) & 0xFFFF),
                                                                      ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),

Review Comment:
   warning: 48 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
                                                                ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),

Review Comment:
   warning: 0xFFFF is a magic number; consider replacing it with a named 
constant [readability-magic-numbers]
   ```cpp
           uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
                                                                      ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);

Review Comment:
   warning: 64 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           uint64_t high = static_cast<uint64_t>(x >> 64);
                                                      ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
                                                                           ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),

Review Comment:
   warning: do not declare C-style arrays, use std::array<> instead 
[modernize-avoid-c-arrays]
   ```cpp
           uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
           ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
+                              static_cast<uint16_t>((high >> 32) & 0xFFFF),

Review Comment:
   warning: 32 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
                                 static_cast<uint16_t>((high >> 32) & 0xFFFF),
                                                                ^
   ```
   



##########
be/src/vec/runtime/ipv6_value.h:
##########
@@ -0,0 +1,262 @@
+// 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 <stdint.h>
+
+#include <regex>
+#include <sstream>
+#include <string>
+
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_number_base.h"
+
+namespace doris {
+
+class IPv6Value {
+public:
+    IPv6Value() { _value = 0; }
+
+    explicit IPv6Value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    [[nodiscard]] const vectorized::IPv6& value() const { return _value; }
+
+    vectorized::IPv6& value() { return _value; }
+
+    void set_value(vectorized::IPv6 ipv6) { _value = ipv6; }
+
+    bool from_string(std::string ipv6) { return from_string(_value, ipv6); }
+
+    bool from_binary_string(std::string ipv6_binary) {
+        return from_binary_string(_value, ipv6_binary);
+    }
+
+    static bool from_string(vectorized::IPv6& x, std::string ipv6) {
+        remove_ipv6_space(ipv6);
+
+        if (ipv6.empty() || !is_valid_string(ipv6)) {
+            return false;
+        }
+
+        std::transform(ipv6.begin(), ipv6.end(), ipv6.begin(),
+                       [](unsigned char ch) { return std::tolower(ch); });
+        std::istringstream iss(ipv6);
+        std::string field;
+        uint16_t fields[8] = {0};
+        uint8_t zero_index = 0;
+        uint8_t num_field = 0;
+        uint8_t right_field_num = 0;
+
+        while (num_field < 8) {
+            if (!getline(iss, field, ':')) {
+                break;
+            }
+
+            if (field.empty()) {
+                zero_index = num_field;
+                fields[num_field++] = 0;
+            } else {
+                try {
+                    if (field.size() > 4 || field > "ffff") {
+                        return false;
+                    }
+
+                    fields[num_field++] = std::stoi(field, nullptr, 16);
+                } catch (const std::exception& /*e*/) {
+                    return false;
+                }
+            }
+        }
+
+        if (zero_index != 0) {
+            right_field_num = num_field - zero_index - 1;
+
+            for (uint8_t i = 7; i > 7 - right_field_num; --i) {
+                fields[i] = fields[zero_index + right_field_num + i - 7];
+                fields[zero_index + right_field_num + i - 7] = 0;
+            }
+        }
+
+        uint64_t high = (static_cast<uint64_t>(fields[0]) << 48) |
+                        (static_cast<uint64_t>(fields[1]) << 32) |
+                        (static_cast<uint64_t>(fields[2]) << 16) | 
static_cast<uint64_t>(fields[3]);
+        uint64_t low = (static_cast<uint64_t>(fields[4]) << 48) |
+                       (static_cast<uint64_t>(fields[5]) << 32) |
+                       (static_cast<uint64_t>(fields[6]) << 16) | 
static_cast<uint64_t>(fields[7]);
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    static bool from_binary_string(vectorized::IPv6& x, std::string 
ipv6_binary_str) {
+        // Accepts a FixedString(16) value containing the IPv6 address in 
binary format
+        if (ipv6_binary_str.size() != 16) {
+            return false;
+        }
+
+        uint64_t high = 0;
+        uint64_t low = 0;
+
+        const uint8_t* ipv6_binary = reinterpret_cast<const 
uint8_t*>(ipv6_binary_str.c_str());
+
+        for (int i = 0; i < 8; ++i) {
+            high |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - i * 8));
+        }
+
+        for (int i = 8; i < 16; ++i) {
+            low |= (static_cast<uint64_t>(ipv6_binary[i]) << (56 - (i - 8) * 
8));
+        }
+
+        x = static_cast<vectorized::IPv6>(high) << 64 | low;
+        return true;
+    }
+
+    [[nodiscard]] std::string to_string() const { return to_string(_value); }
+
+    static std::string to_string(vectorized::IPv6 x) {
+        // "0000:0000:0000:0000:0000:0000:0000:0000"
+        if (x == 0) {
+            return "::";
+        }
+
+        uint64_t low = static_cast<uint64_t>(x);
+        uint64_t high = static_cast<uint64_t>(x >> 64);
+
+        uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           uint16_t fields[8] = {static_cast<uint16_t>((high >> 48) & 0xFFFF),
                           ^
   ```
   



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