iceberg-cpp
Loading...
Searching...
No Matches
v3_metadata_internal.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
23
25#include "iceberg/result.h"
26
27namespace iceberg {
28
31 public:
32 ManifestEntryAdapterV3(std::optional<int64_t> snapshot_id,
33 std::optional<int64_t> first_row_id,
34 std::shared_ptr<PartitionSpec> partition_spec,
35 std::shared_ptr<Schema> current_schema, ManifestContent content);
36
37 Status Init() override;
38 Status Append(const ManifestEntry& entry) override;
39
40 static std::shared_ptr<Schema> EntrySchema(std::shared_ptr<StructType> partition_type);
41 static std::shared_ptr<Schema> WrapFileSchema(std::shared_ptr<StructType> file_schema);
42 static std::shared_ptr<StructType> DataFileType(
43 std::shared_ptr<StructType> partition_type);
44
45 protected:
46 Result<std::optional<int64_t>> GetSequenceNumber(
47 const ManifestEntry& entry) const override;
48 Result<std::optional<std::string>> GetReferenceDataFile(
49 const DataFile& file) const override;
50 Result<std::optional<int64_t>> GetFirstRowId(const DataFile& file) const override;
51 Result<std::optional<int64_t>> GetContentOffset(const DataFile& file) const override;
52 Result<std::optional<int64_t>> GetContentSizeInBytes(
53 const DataFile& file) const override;
54
55 private:
56 std::optional<int64_t> first_row_id_;
57};
58
61 public:
62 ManifestFileAdapterV3(int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
63 int64_t sequence_number, std::optional<int64_t> first_row_id)
64 : snapshot_id_(snapshot_id),
65 parent_snapshot_id_(parent_snapshot_id),
66 sequence_number_(sequence_number),
67 next_row_id_(first_row_id) {}
68 Status Init() override;
69 Status Append(const ManifestFile& file) override;
70 std::optional<int64_t> next_row_id() const override { return next_row_id_; }
71
72 static const std::shared_ptr<Schema> kManifestListSchema;
73
74 protected:
75 Result<int64_t> GetSequenceNumber(const ManifestFile& file) const override;
76 Result<int64_t> GetMinSequenceNumber(const ManifestFile& file) const override;
77 Result<std::optional<int64_t>> GetFirstRowId(const ManifestFile& file) const override;
78
79 private:
80 bool WrapFirstRowId(const ManifestFile& file) const;
81
82 private:
83 int64_t snapshot_id_;
84 std::optional<int64_t> parent_snapshot_id_;
85 int64_t sequence_number_;
86 std::optional<int64_t> next_row_id_;
87};
88
89} // namespace iceberg
Adapter to convert V3 ManifestEntry to ArrowArray.
Definition v3_metadata_internal.h:30
Adapter for appending a list of ManifestEntrys to an ArrowArray. Implemented by different versions wi...
Definition manifest_adapter_internal.h:61
Adapter to convert V3 ManifestFile to ArrowArray.
Definition v3_metadata_internal.h:60
Adapter for appending a list of ManifestFiles to an ArrowArray. Implemented by different versions wit...
Definition manifest_adapter_internal.h:110
ManifestContent
The type of files tracked by the manifest, either data or delete files; 0 for all v1 manifests.
Definition manifest_list.h:77
DataFile carries data file path, partition tuple, metrics, ...
Definition manifest_entry.h:62
A manifest is an immutable Avro file that lists data files or delete files, along with each file's pa...
Definition manifest_entry.h:307
Entry in a manifest list.
Definition manifest_list.h:85