|
|
EnumDictType | dict_type |
| |
|
idx_t | dict_size |
| |
◆ EnumTypeInfo()
| duckdb::EnumTypeInfo::EnumTypeInfo |
( |
Vector & |
values_insert_order_p, |
|
|
idx_t |
dict_size_p |
|
) |
| |
|
explicit |
72449 : ExtraTypeInfo(ExtraTypeInfoType::ENUM_TYPE_INFO), values_insert_order(values_insert_order_p),
72450 dict_type(EnumDictType::VECTOR_DICT), dict_size(dict_size_p) {
72451}
◆ GetEnumDictType()
| const EnumDictType & duckdb::EnumTypeInfo::GetEnumDictType |
( |
| ) |
const |
72453 {
72454 return dict_type;
72455}
◆ GetValuesInsertOrder()
| const Vector & duckdb::EnumTypeInfo::GetValuesInsertOrder |
( |
| ) |
const |
72457 {
72458 return values_insert_order;
72459}
◆ GetDictSize()
| const idx_t & duckdb::EnumTypeInfo::GetDictSize |
( |
| ) |
const |
72461 {
72462 return dict_size;
72463}
◆ DictType()
72436 {
72437 if (size <= NumericLimits<uint8_t>::Maximum()) {
72439 } else if (size <= NumericLimits<uint16_t>::Maximum()) {
72441 } else if (size <= NumericLimits<uint32_t>::Maximum()) {
72443 } else {
72444 throw InternalException("Enum size must be lower than " + std::to_string(NumericLimits<uint32_t>::Maximum()));
72445 }
72446}
@ UINT32
Unsigned 32-bit little-endian integer.
@ UINT16
Unsigned 16-bit little-endian integer.
@ UINT8
Unsigned 8-bit little-endian integer.
◆ CreateType()
72465 {
72466
72467 shared_ptr<ExtraTypeInfo> info;
72468 auto enum_internal_type = EnumTypeInfo::DictType(size);
72469 switch (enum_internal_type) {
72471 info = make_shared_ptr<EnumTypeInfoTemplated<uint8_t>>(ordered_data,
size);
72472 break;
72474 info = make_shared_ptr<EnumTypeInfoTemplated<uint16_t>>(ordered_data,
size);
72475 break;
72477 info = make_shared_ptr<EnumTypeInfoTemplated<uint32_t>>(ordered_data,
size);
72478 break;
72479 default:
72480 throw InternalException("Invalid Physical Type for ENUMs");
72481 }
72482
72483 return LogicalType(LogicalTypeId::ENUM, info);
72484}
GOpaque< Size > size(const GMat &src)
◆ Serialize()
Reimplemented from duckdb::ExtraTypeInfo.
72552 {
72553 ExtraTypeInfo::Serialize(serializer);
72554
72555
72556 auto strings = FlatVector::GetData<string_t>(values_insert_order);
72557 serializer.WriteProperty(200, "values_count", dict_size);
72558 serializer.WriteList(201, "values", dict_size,
72559 [&](Serializer::List &list, idx_t i) { list.WriteElement(strings[i]); });
72560}
◆ Deserialize()
72514 {
72515 auto values_count = deserializer.ReadProperty<idx_t>(200, "values_count");
72516 auto enum_internal_type = EnumTypeInfo::DictType(values_count);
72517 switch (enum_internal_type) {
72519 return EnumTypeInfoTemplated<uint8_t>::Deserialize(deserializer, NumericCast<uint32_t>(values_count));
72521 return EnumTypeInfoTemplated<uint16_t>::Deserialize(deserializer, NumericCast<uint32_t>(values_count));
72523 return EnumTypeInfoTemplated<uint32_t>::Deserialize(deserializer, NumericCast<uint32_t>(values_count));
72524 default:
72525 throw InternalException("Invalid Physical Type for ENUMs");
72526 }
72527}
◆ Copy()
Reimplemented from duckdb::ExtraTypeInfo.
72562 {
72563 Vector values_insert_order_copy(LogicalType::VARCHAR, false, false, 0);
72564 values_insert_order_copy.Reference(values_insert_order);
72565 return make_shared_ptr<EnumTypeInfo>(values_insert_order_copy, dict_size);
72566}
◆ EqualsInternal()
| bool duckdb::EnumTypeInfo::EqualsInternal |
( |
ExtraTypeInfo * |
other_p | ) |
const |
|
overrideprotectedvirtual |
Reimplemented from duckdb::ExtraTypeInfo.
72530 {
72531 auto &other = other_p->Cast<EnumTypeInfo>();
72532 if (dict_type != other.dict_type) {
72533 return false;
72534 }
72535 D_ASSERT(dict_type == EnumDictType::VECTOR_DICT);
72536
72537 if (other.dict_size != dict_size) {
72538 return false;
72539 }
72540 auto other_vector_ptr = FlatVector::GetData<string_t>(other.values_insert_order);
72541 auto this_vector_ptr = FlatVector::GetData<string_t>(values_insert_order);
72542
72543
72544 for (idx_t i = 0; i < dict_size; i++) {
72545 if (!Equals::Operation(other_vector_ptr[i], this_vector_ptr[i])) {
72546 return false;
72547 }
72548 }
72549 return true;
72550}
The documentation for this struct was generated from the following file:
- external/duckdb/duckdb.cpp