MCPcopy Create free account
hub / github.com/apache/impala / AddVirtualIcebergColumn

Method AddVirtualIcebergColumn

be/src/exec/file-metadata-utils.cc:240–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void 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
278bool FileMetadataUtils::IsValuePartitionCol(const SlotDescriptor* slot_desc) {
279 DCHECK(file_desc_ != nullptr);

Callers

nothing calls this directly

Calls 15

IsVirtualMethod · 0.80
virtual_column_typeMethod · 0.80
GetIntSlotMethod · 0.80
tuple_offsetMethod · 0.80
GetStringSlotMethod · 0.80
SetNotNullMethod · 0.80
Base64EncodeFunction · 0.50
sizeMethod · 0.45
GetMethod · 0.45
dataMethod · 0.45
strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected