|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include <cstdint> |
| 23 | +#include <string> |
| 24 | +#include <unordered_map> |
| 25 | + |
| 26 | +#include "iceberg/constants.h" |
| 27 | +#include "iceberg/iceberg_export.h" |
| 28 | + |
| 29 | +namespace iceberg { |
| 30 | + |
| 31 | +/// \brief Metrics collected during a table commit (snapshot creation). |
| 32 | +/// |
| 33 | +struct ICEBERG_EXPORT CommitMetrics { |
| 34 | + /// \brief Number of data files added in this commit. |
| 35 | + int64_t added_data_files = 0; |
| 36 | + /// \brief Number of data files removed in this commit. |
| 37 | + int64_t removed_data_files = 0; |
| 38 | + /// \brief Total live data files after this commit. |
| 39 | + int64_t total_data_files = 0; |
| 40 | + /// \brief Number of delete files added in this commit. |
| 41 | + int64_t added_delete_files = 0; |
| 42 | + /// \brief Equality delete files added. |
| 43 | + int64_t added_equality_delete_files = 0; |
| 44 | + /// \brief Positional delete files added. |
| 45 | + int64_t added_positional_delete_files = 0; |
| 46 | + /// \brief Deletion vectors added. |
| 47 | + int64_t added_dvs = 0; |
| 48 | + /// \brief Positional delete files removed. |
| 49 | + int64_t removed_positional_delete_files = 0; |
| 50 | + /// \brief Deletion vectors removed. |
| 51 | + int64_t removed_dvs = 0; |
| 52 | + /// \brief Equality delete files removed. |
| 53 | + int64_t removed_equality_delete_files = 0; |
| 54 | + /// \brief Number of delete files removed in this commit. |
| 55 | + int64_t removed_delete_files = 0; |
| 56 | + /// \brief Total live delete files after this commit. |
| 57 | + int64_t total_delete_files = 0; |
| 58 | + /// \brief Number of records added in this commit. |
| 59 | + int64_t added_records = 0; |
| 60 | + /// \brief Number of records removed in this commit. |
| 61 | + int64_t removed_records = 0; |
| 62 | + /// \brief Total live records after this commit. |
| 63 | + int64_t total_records = 0; |
| 64 | + /// \brief Total byte size of files added. |
| 65 | + int64_t added_files_size_bytes = 0; |
| 66 | + /// \brief Total byte size of files removed. |
| 67 | + int64_t removed_files_size_bytes = 0; |
| 68 | + /// \brief Total byte size of all live files after this commit. |
| 69 | + int64_t total_files_size_bytes = 0; |
| 70 | + /// \brief Positional delete records added. |
| 71 | + int64_t added_positional_deletes = 0; |
| 72 | + /// \brief Positional delete records removed. |
| 73 | + int64_t removed_positional_deletes = 0; |
| 74 | + /// \brief Total positional delete records after this commit. |
| 75 | + int64_t total_positional_deletes = 0; |
| 76 | + /// \brief Equality delete records added. |
| 77 | + int64_t added_equality_deletes = 0; |
| 78 | + /// \brief Equality delete records removed. |
| 79 | + int64_t removed_equality_deletes = 0; |
| 80 | + /// \brief Total equality delete records after this commit. |
| 81 | + int64_t total_equality_deletes = 0; |
| 82 | + /// \brief Manifest files kept unchanged in this commit. |
| 83 | + int64_t kept_manifest_count = 0; |
| 84 | + /// \brief Manifest files created in this commit. |
| 85 | + int64_t created_manifest_count = 0; |
| 86 | + /// \brief Manifest files replaced in this commit. |
| 87 | + int64_t replaced_manifest_count = 0; |
| 88 | + /// \brief Manifest entries processed in this commit. |
| 89 | + int64_t processed_manifest_entries_count = 0; |
| 90 | +}; |
| 91 | + |
| 92 | +/// \brief Report generated after a commit operation. |
| 93 | +/// |
| 94 | +/// Contains metrics about the changes made in a commit, including |
| 95 | +/// files added/removed and retry information. |
| 96 | +struct ICEBERG_EXPORT CommitReport { |
| 97 | + /// \brief The fully qualified name of the table that was modified. |
| 98 | + std::string table_name; |
| 99 | + /// \brief The snapshot ID created by this commit. |
| 100 | + int64_t snapshot_id = kInvalidSnapshotId; |
| 101 | + /// \brief The sequence number assigned to this commit. |
| 102 | + int64_t sequence_number = kInvalidSequenceNumber; |
| 103 | + /// \brief The operation that was performed (append, overwrite, delete, etc.). |
| 104 | + std::string operation; |
| 105 | + /// \brief Metrics collected during the commit operation. |
| 106 | + CommitMetrics commit_metrics; |
| 107 | + /// \brief Additional key-value metadata. |
| 108 | + std::unordered_map<std::string, std::string> metadata; |
| 109 | +}; |
| 110 | + |
| 111 | +} // namespace iceberg |
0 commit comments