[cherry-pick](branch-2.1) Pick "[feature](function) support ip functions named ipv4_to_ipv6 and cut_ipv6" (#39058)
## Proposed changes Issue Number: close #xxx <!--Describe your changes.--> pick https://github.com/apache/doris/pull/36883 and https://github.com/apache/doris/pull/35239
This commit is contained in:
@ -30,6 +30,8 @@
|
||||
#include "vec/data_types/data_type_date.h"
|
||||
#include "vec/data_types/data_type_date_time.h"
|
||||
#include "vec/data_types/data_type_decimal.h"
|
||||
#include "vec/data_types/data_type_ipv4.h"
|
||||
#include "vec/data_types/data_type_ipv6.h"
|
||||
#include "vec/data_types/data_type_jsonb.h"
|
||||
#include "vec/data_types/data_type_string.h"
|
||||
#include "vec/data_types/data_type_time_v2.h"
|
||||
@ -98,6 +100,14 @@ size_t type_index_to_data_type(const std::vector<AnyType>& input_types, size_t i
|
||||
desc.type = doris::PrimitiveType::TYPE_OBJECT;
|
||||
type = std::make_shared<DataTypeBitMap>();
|
||||
return 1;
|
||||
case TypeIndex::IPv4:
|
||||
desc.type = doris::PrimitiveType::TYPE_IPV4;
|
||||
type = std::make_shared<DataTypeIPv4>();
|
||||
return 1;
|
||||
case TypeIndex::IPv6:
|
||||
desc.type = doris::PrimitiveType::TYPE_IPV6;
|
||||
type = std::make_shared<DataTypeIPv6>();
|
||||
return 1;
|
||||
case TypeIndex::UInt8:
|
||||
desc.type = doris::PrimitiveType::TYPE_BOOLEAN;
|
||||
type = std::make_shared<DataTypeUInt8>();
|
||||
@ -242,6 +252,12 @@ bool insert_cell(MutableColumnPtr& column, DataTypePtr type_ptr, const AnyType&
|
||||
} else if (type.idx == TypeIndex::BitMap) {
|
||||
BitmapValue* bitmap = any_cast<BitmapValue*>(cell);
|
||||
column->insert_data((char*)bitmap, sizeof(BitmapValue));
|
||||
} else if (type.is_ipv4()) {
|
||||
auto value = any_cast<ut_type::IPV4>(cell);
|
||||
column->insert_data(reinterpret_cast<char*>(&value), 0);
|
||||
} else if (type.is_ipv6()) {
|
||||
auto value = any_cast<ut_type::IPV6>(cell);
|
||||
column->insert_data(reinterpret_cast<char*>(&value), 0);
|
||||
} else if (type.is_uint8()) {
|
||||
auto value = any_cast<ut_type::BOOLEAN>(cell);
|
||||
column->insert_data(reinterpret_cast<char*>(&value), 0);
|
||||
|
||||
Reference in New Issue
Block a user