iceberg-cpp
Loading...
Searching...
No Matches
snapshots_table.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
24
25#include <cstdint>
26#include <memory>
27
32#include "iceberg/result.h"
33#include "iceberg/type_fwd.h"
34
35namespace iceberg {
36
38class ICEBERG_EXPORT SnapshotsTable : public MetadataTable {
39 public:
40 static Result<std::unique_ptr<SnapshotsTable>> Make(std::shared_ptr<const Table> table);
41
43 static const std::shared_ptr<Schema>& CanonicalSchema();
44
45 ~SnapshotsTable() override;
46
47 MetadataTableKind kind() const noexcept override {
48 return MetadataTableKind::kSnapshots;
49 }
50
51 const std::shared_ptr<Schema>& schema() const override;
52
53 protected:
55 internal::MetadataScanContext context) const override;
56
57 private:
58 friend class MetadataScanTaskReader;
59
60 static Result<ArrowArrayStream> ReadRows(
61 std::shared_ptr<const TableMetadata> metadata,
62 const std::shared_ptr<Schema>& projected_schema, int64_t batch_size);
63
64 explicit SnapshotsTable(std::shared_ptr<const Table> table);
65};
66
68class ICEBERG_EXPORT SnapshotsScan final : public MetadataScan {
69 public:
73
74 ~SnapshotsScan() override;
75
77
78 private:
80 std::shared_ptr<MetadataScanTask> task);
81
82 const std::shared_ptr<MetadataScanTask> task_;
83};
84
85} // namespace iceberg
Opens metadata scan tasks as Arrow streams.
Definition metadata_scan_task_reader.h:33
A metadata scan that plans tasks or reads all of them as Arrow batches.
Definition metadata_scan.h:107
A metadata table backed by a source Iceberg table.
Definition metadata_table.h:60
Scan the snapshots metadata captured from a table.
Definition snapshots_table.h:68
static Result< std::unique_ptr< SnapshotsScan > > Make(internal::MetadataScanContext context)
Create a scan from captured metadata table settings.
Result< MetadataScanTaskStreamPtr > PlanTasksStream() const override
Return a fresh task stream; consuming it may report planning errors.
Snapshots metadata table.
Definition snapshots_table.h:38
MetadataTableKind kind() const noexcept override
Return this metadata table's kind.
Definition snapshots_table.h:47
Result< std::unique_ptr< MetadataScan > > MakeScan(internal::MetadataScanContext context) const override
Plan a scan using the captured metadata, projection, and snapshot selection.
const std::shared_ptr< Schema > & schema() const override
Return the complete canonical schema of this metadata table.
static const std::shared_ptr< Schema > & CanonicalSchema()
Return the canonical schema of the snapshots metadata table.
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Configure metadata scans, plan reusable tasks, and read Arrow batches.
Metadata table factories, schemas, and scan entry points.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
MetadataTableKind
Iceberg metadata tables exposed by Table::Inspect().
Definition metadata_table.h:40
Define Result, Status, and error helpers.
Captured metadata and logical settings shared by a builder and its scans.
Definition metadata_scan.h:46