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"
32
33namespace iceberg {
34
36class ICEBERG_EXPORT PartitionFieldSummaryStructLike : public StructLike {
37 public:
39 : summary_(summary) {}
40 ~PartitionFieldSummaryStructLike() override = default;
41
44 delete;
45
46 Result<Scalar> GetField(size_t pos) const override;
47
48 size_t num_fields() const override { return 4; }
49
50 void Reset(const PartitionFieldSummary& summary) { summary_ = std::cref(summary); }
51
52 private:
53 std::reference_wrapper<const PartitionFieldSummary> summary_;
54};
55
57class ICEBERG_EXPORT PartitionFieldSummaryArrayLike : public ArrayLike {
58 public:
60 const std::vector<PartitionFieldSummary>& summaries)
61 : summaries_(summaries) {}
62 ~PartitionFieldSummaryArrayLike() override = default;
63
66 delete;
67
68 Result<Scalar> GetElement(size_t pos) const override;
69
70 size_t size() const override { return summaries_.get().size(); }
71
72 void Reset(const std::vector<PartitionFieldSummary>& summaries) {
73 summaries_ = std::cref(summaries);
74 }
75
76 private:
77 std::reference_wrapper<const std::vector<PartitionFieldSummary>> summaries_;
78 mutable std::shared_ptr<PartitionFieldSummaryStructLike> summary_;
79};
80
82class ICEBERG_EXPORT ManifestFileStructLike : public StructLike {
83 public:
84 explicit ManifestFileStructLike(const ManifestFile& file) : manifest_file_(file) {}
85 ~ManifestFileStructLike() override = default;
86
88 ManifestFileStructLike& operator=(const ManifestFileStructLike&) = delete;
89
90 Result<Scalar> GetField(size_t pos) const override;
91
92 size_t num_fields() const override;
93
94 void Reset(const ManifestFile& file) { manifest_file_ = std::cref(file); }
95
96 private:
97 std::reference_wrapper<const ManifestFile> manifest_file_;
98 mutable std::shared_ptr<PartitionFieldSummaryArrayLike> summaries_;
99};
100
102class ICEBERG_EXPORT DataFileStructLike : public StructLike {
103 public:
104 explicit DataFileStructLike(const DataFile& file) : data_file_(file) {}
105 ~DataFileStructLike() override = default;
106
107 DataFileStructLike(const DataFileStructLike&) = delete;
108 DataFileStructLike& operator=(const DataFileStructLike&) = delete;
109
110 Result<Scalar> GetField(size_t pos) const override;
111
112 size_t num_fields() const override;
113
114 void Reset(const DataFile& file) { data_file_ = std::cref(file); }
115
116 private:
117 std::reference_wrapper<const DataFile> data_file_;
118 mutable std::shared_ptr<StructLike> partition_;
119};
120
121} // namespace iceberg
An immutable array-like wrapper.
Definition struct_like.h:75
StructLike wrapper for DataFile metadata.
Definition manifest_wrapper.h:102
StructLike wrapper for ManifestFile.
Definition manifest_wrapper.h:82
ArrayLike wrapper for a vector of PartitionFieldSummary.
Definition manifest_wrapper.h:57
size_t size() const override
Get the number of elements in the array.
Definition manifest_wrapper.h:70
StructLike wrapper for PartitionFieldSummary.
Definition manifest_wrapper.h:36
size_t num_fields() const override
Get the number of fields in the struct.
Definition manifest_wrapper.h:48
An immutable struct-like wrapper.
Definition struct_like.h:62
DataFile carries data file path, partition tuple, metrics, ...
Definition manifest_entry.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