iceberg-cpp
Loading...
Searching...
No Matches
update_partition_statistics.h
Go to the documentation of this file.
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 <memory>
24#include <unordered_map>
25#include <utility>
26#include <vector>
27
28#include "iceberg/iceberg_export.h"
29#include "iceberg/result.h"
30#include "iceberg/type_fwd.h"
32
35
36namespace iceberg {
37
39class ICEBERG_EXPORT UpdatePartitionStatistics : public PendingUpdate {
40 public:
41 static Result<std::shared_ptr<UpdatePartitionStatistics>> Make(
42 std::shared_ptr<TransactionContext> ctx);
43
45
53 UpdatePartitionStatistics& SetPartitionStatistics(
54 std::shared_ptr<PartitionStatisticsFile> partition_statistics_file);
55
62 UpdatePartitionStatistics& RemovePartitionStatistics(int64_t snapshot_id);
63
64 Kind kind() const final { return Kind::kUpdatePartitionStatistics; }
65
71 bool IsRetryable() const override { return false; }
72
73 struct ApplyResult {
74 std::vector<std::pair<int64_t, std::shared_ptr<PartitionStatisticsFile>>> to_set;
75 std::vector<int64_t> to_remove;
76 };
77
78 Result<ApplyResult> Apply();
79
80 private:
81 explicit UpdatePartitionStatistics(std::shared_ptr<TransactionContext> ctx);
82
83 std::unordered_map<int64_t, std::shared_ptr<PartitionStatisticsFile>>
84 partition_statistics_to_set_;
85};
86
87} // namespace iceberg
Base class for all kinds of table metadata updates.
Definition pending_update.h:41
Updates table partition statistics.
Definition update_partition_statistics.h:39
bool IsRetryable() const override
Partition statistics updates are intentionally not retried today.
Definition update_partition_statistics.h:71
Kind kind() const final
Return the kind of this pending update.
Definition update_partition_statistics.h:64
Definition update_partition_statistics.h:73