Helper function to add puffin file entries with deletion vectors. Creates one FbIcebergDataFile entry per data file that has deletion vectors. This is called for puffin files only.
| 711 | // Creates one FbIcebergDataFile entry per data file that has deletion vectors. |
| 712 | // This is called for puffin files only. |
| 713 | void DmlExecState::AddPuffinDeletionVectorEntries(const OutputPartition& partition) { |
| 714 | // Note: lock_ is already held by AddFileAux |
| 715 | |
| 716 | const string& puffin_path = partition.current_file_final_name.empty() |
| 717 | ? partition.current_file_name |
| 718 | : partition.current_file_final_name; |
| 719 | |
| 720 | // Build a unified map of all data files with deletion vectors (old and/or new) |
| 721 | // Map: data_file_path -> (old_dv_ptr, new_dv_ptr) |
| 722 | std::map<std::string, |
| 723 | std::pair<const TIcebergDeletionVector*, const TIcebergDeletionVector*>> |
| 724 | data_file_to_dvs; |
| 725 | |
| 726 | // Collect old deletion vectors |
| 727 | for (const auto& entry : partition.puffin_result.old_deletion_vectors) { |
| 728 | data_file_to_dvs[entry.first].first = &entry.second; |
| 729 | } |
| 730 | |
| 731 | // Collect new deletion vectors |
| 732 | for (const auto& entry : partition.puffin_result.new_deletion_vectors) { |
| 733 | data_file_to_dvs[entry.first].second = &entry.second; |
| 734 | } |
| 735 | |
| 736 | // Create one FbIcebergDataFile entry per data file with deletion vectors |
| 737 | PartitionStatusMap::iterator partition_entry = |
| 738 | per_partition_status_.find(partition.partition_name); |
| 739 | DCHECK(partition_entry != per_partition_status_.end()); |
| 740 | |
| 741 | for (const auto& entry : data_file_to_dvs) { |
| 742 | const string& referenced_data_file = entry.first; |
| 743 | const TIcebergDeletionVector* old_dv = entry.second.first; |
| 744 | const TIcebergDeletionVector* new_dv = entry.second.second; |
| 745 | |
| 746 | DmlFileStatusPb* file = partition_entry->second.add_created_delete_files(); |
| 747 | |
| 748 | file->set_final_path(puffin_path); |
| 749 | if (!partition.current_file_final_name.empty()) { |
| 750 | file->set_staging_path(partition.current_file_name); |
| 751 | } |
| 752 | |
| 753 | // For deletion vectors, use the DV record count and the total puffin file size. |
| 754 | file->set_num_rows(new_dv && new_dv->__isset.record_count ? new_dv->record_count : 0); |
| 755 | file->set_size(partition.current_file_bytes); |
| 756 | |
| 757 | file->set_iceberg_data_file_fb( |
| 758 | createIcebergDataFileWithDeletionVectorString( |
| 759 | partition, puffin_path, partition.current_file_bytes, |
| 760 | referenced_data_file, old_dv, new_dv)); |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | void DmlExecState::AddFileAux(const OutputPartition& partition, bool is_iceberg, |
| 765 | const IcebergFileStats& insert_stats, bool is_delete) { |
nothing calls this directly
no test coverage detected