@@ -34,12 +34,13 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
3434 public:
3535 using SpecType = std::map<std::string, std::string>;
3636 PartitionStatistics (const SpecType& spec, int64_t record_count, int64_t file_size_in_bytes,
37- int64_t file_count, int64_t last_file_creation_time)
37+ int64_t file_count, int64_t last_file_creation_time, int32_t total_buckets )
3838 : spec_(spec),
3939 record_count_ (record_count),
4040 file_size_in_bytes_(file_size_in_bytes),
4141 file_count_(file_count),
42- last_file_creation_time_(last_file_creation_time) {}
42+ last_file_creation_time_(last_file_creation_time),
43+ total_buckets_(total_buckets) {}
4344
4445 const SpecType& Spec () const {
4546 return spec_;
@@ -56,6 +57,9 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
5657 int64_t LastFileCreationTime () const {
5758 return last_file_creation_time_;
5859 }
60+ int32_t TotalBuckets () const {
61+ return total_buckets_;
62+ }
5963
6064 rapidjson::Value ToJson (rapidjson::Document::AllocatorType* allocator) const
6165 noexcept (false ) override {
@@ -72,6 +76,8 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
7276 obj.AddMember (rapidjson::StringRef (FIELD_LAST_FILE_CREATION_TIME ),
7377 RapidJsonUtil::SerializeValue (last_file_creation_time_, allocator).Move (),
7478 *allocator);
79+ obj.AddMember (rapidjson::StringRef (FIELD_TOTAL_BUCKETS ),
80+ RapidJsonUtil::SerializeValue (total_buckets_, allocator).Move (), *allocator);
7581 return obj;
7682 }
7783
@@ -83,12 +89,14 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
8389 file_count_ = RapidJsonUtil::DeserializeKeyValue<int64_t >(obj, FIELD_FILE_COUNT );
8490 last_file_creation_time_ =
8591 RapidJsonUtil::DeserializeKeyValue<int64_t >(obj, FIELD_LAST_FILE_CREATION_TIME );
92+ total_buckets_ = RapidJsonUtil::DeserializeKeyValue<int32_t >(obj, FIELD_TOTAL_BUCKETS );
8693 }
8794
8895 bool operator ==(const PartitionStatistics& rhs) const {
8996 return record_count_ == rhs.record_count_ &&
9097 file_size_in_bytes_ == rhs.file_size_in_bytes_ && file_count_ == rhs.file_count_ &&
91- last_file_creation_time_ == rhs.last_file_creation_time_ && spec_ == rhs.spec_ ;
98+ last_file_creation_time_ == rhs.last_file_creation_time_ &&
99+ total_buckets_ == rhs.total_buckets_ && spec_ == rhs.spec_ ;
92100 }
93101
94102 std::string ToString () const {
@@ -102,7 +110,8 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
102110 }
103111 oss << " }, recordCount=" << record_count_ << " , fileSizeInBytes=" << file_size_in_bytes_
104112 << " , fileCount=" << file_count_
105- << " , lastFileCreationTime=" << last_file_creation_time_ << " }" ;
113+ << " , lastFileCreationTime=" << last_file_creation_time_
114+ << " , totalBuckets=" << total_buckets_ << " }" ;
106115 return oss.str ();
107116 }
108117
@@ -115,12 +124,14 @@ class PartitionStatistics : public Jsonizable<PartitionStatistics> {
115124 static constexpr const char * FIELD_FILE_SIZE_IN_BYTES = " fileSizeInBytes" ;
116125 static constexpr const char * FIELD_FILE_COUNT = " fileCount" ;
117126 static constexpr const char * FIELD_LAST_FILE_CREATION_TIME = " lastFileCreationTime" ;
127+ static constexpr const char * FIELD_TOTAL_BUCKETS = " totalBuckets" ;
118128
119129 SpecType spec_;
120130 int64_t record_count_ = 0 ;
121131 int64_t file_size_in_bytes_ = 0 ;
122132 int64_t file_count_ = 0 ;
123133 int64_t last_file_creation_time_ = 0 ;
134+ int32_t total_buckets_ = 0 ;
124135};
125136
126137} // namespace paimon
0 commit comments