iceberg-cpp
Loading...
Searching...
No Matches
manifest_wrapper.h
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
25
26#include <functional>
27
28#include "iceberg/iceberg_export.h"
31
32namespace iceberg {
33
35class ICEBERG_EXPORT PartitionFieldSummaryStructLike : public StructLike {
36 public:
38 : summary_(summary) {}
39 ~PartitionFieldSummaryStructLike() override = default;
40
43 delete;
44
45 Result<Scalar> GetField(size_t pos) const override;
46
47 size_t num_fields() const override { return 4; }
48
49 void Reset(const PartitionFieldSummary& summary) { summary_ = std::cref(summary); }
50
51 private:
52 std::reference_wrapper<const PartitionFieldSummary> summary_;
53};
54
56class ICEBERG_EXPORT PartitionFieldSummaryArrayLike : public ArrayLike {
57 public:
59 const std::vector<PartitionFieldSummary>& summaries)
60 : summaries_(summaries) {}
61 ~PartitionFieldSummaryArrayLike() override = default;
62
65 delete;
66
67 Result<Scalar> GetElement(size_t pos) const override;
68
69 size_t size() const override { return summaries_.get().size(); }
70
71 void Reset(const std::vector<PartitionFieldSummary>& summaries) {
72 summaries_ = std::cref(summaries);
73 }
74
75 private:
76 std::reference_wrapper<const std::vector<PartitionFieldSummary>> summaries_;
77 mutable std::shared_ptr<PartitionFieldSummaryStructLike> summary_;
78};
79
81class ICEBERG_EXPORT ManifestFileStructLike : public StructLike {
82 public:
83 explicit ManifestFileStructLike(const ManifestFile& file) : manifest_file_(file) {}
84 ~ManifestFileStructLike() override = default;
85
87 ManifestFileStructLike& operator=(const ManifestFileStructLike&) = delete;
88
89 Result<Scalar> GetField(size_t pos) const override;
90
91 size_t num_fields() const override;
92
93 void Reset(const ManifestFile& file) { manifest_file_ = std::cref(file); }
94
95 private:
96 std::reference_wrapper<const ManifestFile> manifest_file_;
97 mutable std::shared_ptr<PartitionFieldSummaryArrayLike> summaries_;
98};
99
100} // namespace iceberg
An immutable array-like wrapper.
Definition struct_like.h:75
StructLike wrapper for ManifestFile.
Definition manifest_wrapper.h:81
ArrayLike wrapper for a vector of PartitionFieldSummary.
Definition manifest_wrapper.h:56
size_t size() const override
Get the number of elements in the array.
Definition manifest_wrapper.h:69
StructLike wrapper for PartitionFieldSummary.
Definition manifest_wrapper.h:35
size_t num_fields() const override
Get the number of fields in the struct.
Definition manifest_wrapper.h:47
An immutable struct-like wrapper.
Definition struct_like.h:62
Entry in a manifest list.
Definition manifest_list.h:85
Field summary for partition field in the spec.
Definition manifest_list.h:43