| 238 | } |
| 239 | |
| 240 | void FileMetadataUtils::AddVirtualIcebergColumn(MemPool* mem_pool, Tuple* template_tuple, |
| 241 | const org::apache::impala::fb::FbIcebergSplitMetadata& ice_metadata, |
| 242 | const SlotDescriptor* slot_desc) { |
| 243 | DCHECK(slot_desc->IsVirtual()); |
| 244 | if (slot_desc->virtual_column_type() == TVirtualColumnType::PARTITION_SPEC_ID) { |
| 245 | int32_t* slot = template_tuple->GetIntSlot(slot_desc->tuple_offset()); |
| 246 | *slot = ice_metadata.spec_id(); |
| 247 | } else if (slot_desc->virtual_column_type() == |
| 248 | TVirtualColumnType::ICEBERG_PARTITION_SERIALIZED) { |
| 249 | auto transforms = ice_metadata.partition_keys(); |
| 250 | if (transforms == nullptr) return; |
| 251 | string partitions; |
| 252 | for (int i = 0; i < transforms->size(); ++i) { |
| 253 | using namespace org::apache::impala::fb; |
| 254 | auto transform = transforms->Get(i); |
| 255 | if (transform->transform_type() == |
| 256 | FbIcebergTransformType::FbIcebergTransformType_VOID) { |
| 257 | continue; |
| 258 | } |
| 259 | stringstream part_ss; |
| 260 | Base64Encode((const char*)transform->transform_value()->data(), |
| 261 | transform->transform_value()->size(), &part_ss); |
| 262 | string part_value(part_ss.str()); |
| 263 | if (partitions.empty()) { |
| 264 | partitions = part_value; |
| 265 | } else { |
| 266 | partitions += '.' + part_value; |
| 267 | } |
| 268 | } |
| 269 | StringValue* slot = template_tuple->GetStringSlot(slot_desc->tuple_offset()); |
| 270 | int len = partitions.length(); |
| 271 | char* partition_serialized_copy = reinterpret_cast<char*>(mem_pool->Allocate(len)); |
| 272 | Ubsan::MemCpy(partition_serialized_copy, partitions.c_str(), len); |
| 273 | slot->Assign(partition_serialized_copy, len); |
| 274 | template_tuple->SetNotNull(slot_desc->null_indicator_offset()); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | bool FileMetadataUtils::IsValuePartitionCol(const SlotDescriptor* slot_desc) { |
| 279 | DCHECK(file_desc_ != nullptr); |
nothing calls this directly
no test coverage detected