iceberg-cpp
Loading...
Searching...
No Matches
metadata_scan_task.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
22#include <memory>
23
25#include "iceberg/result.h"
26#include "iceberg/type_fwd.h"
27
28namespace iceberg {
29
34class ICEBERG_EXPORT MetadataScanTask {
35 public:
37 enum class TaskKind {
39 kStatic,
40 };
41
42 virtual ~MetadataScanTask() = default;
43
45 virtual TaskKind task_kind() const = 0;
46
48 virtual MetadataTableKind table_kind() const = 0;
49};
50
56class ICEBERG_EXPORT StaticMetadataTask : public MetadataScanTask {
57 public:
65 MetadataTableKind table_kind, std::shared_ptr<const TableMetadata> metadata,
66 std::shared_ptr<Schema> projected_schema);
67
68 TaskKind task_kind() const override { return TaskKind::kStatic; }
69
70 MetadataTableKind table_kind() const override { return table_kind_; }
71
73 const std::shared_ptr<const TableMetadata>& metadata() const { return metadata_; }
74
76 const std::shared_ptr<Schema>& projected_schema() const { return projected_schema_; }
77
78 private:
80 std::shared_ptr<const TableMetadata> metadata,
81 std::shared_ptr<Schema> projected_schema);
82
83 const MetadataTableKind table_kind_;
84 const std::shared_ptr<const TableMetadata> metadata_;
85 const std::shared_ptr<Schema> projected_schema_;
86};
87
88} // namespace iceberg
Base class for metadata table scan tasks.
Definition metadata_scan_task.h:34
virtual MetadataTableKind table_kind() const =0
Return the metadata table whose rows this task produces.
TaskKind
Task category, determines how the reader opens the task.
Definition metadata_scan_task.h:37
virtual TaskKind task_kind() const =0
Return how this task is read.
Task for static metadata tables (snapshots, history, refs).
Definition metadata_scan_task.h:56
const std::shared_ptr< Schema > & projected_schema() const
Return the output schema captured when this task was planned.
Definition metadata_scan_task.h:76
MetadataTableKind table_kind() const override
Return the metadata table whose rows this task produces.
Definition metadata_scan_task.h:70
const std::shared_ptr< const TableMetadata > & metadata() const
Return the captured metadata and its shared ownership.
Definition metadata_scan_task.h:73
static Result< std::shared_ptr< StaticMetadataTask > > Make(MetadataTableKind table_kind, std::shared_ptr< const TableMetadata > metadata, std::shared_ptr< Schema > projected_schema)
Create a static metadata task.
TaskKind task_kind() const override
Return how this task is read.
Definition metadata_scan_task.h:68
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
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.