iceberg-cpp
Loading...
Searching...
No Matches
hive_catalog.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
22#include <memory>
23#include <string>
24#include <unordered_set>
25
26#include "iceberg/catalog.h"
28#include "iceberg/catalog/hive/iceberg_hive_export.h"
29#include "iceberg/result.h"
30
33
34namespace iceberg::hive {
35
41class ICEBERG_HIVE_EXPORT HiveCatalog : public Catalog,
42 public std::enable_shared_from_this<HiveCatalog> {
43 public:
44 ~HiveCatalog() override;
45
46 HiveCatalog(const HiveCatalog&) = delete;
47 HiveCatalog& operator=(const HiveCatalog&) = delete;
48 HiveCatalog(HiveCatalog&&) = delete;
49 HiveCatalog& operator=(HiveCatalog&&) = delete;
50
56 static Result<std::shared_ptr<HiveCatalog>> Make(const HiveCatalogProperties& config);
57
58 std::string_view name() const override;
59
60 Status CreateNamespace(
61 const Namespace& ns,
62 const std::unordered_map<std::string, std::string>& properties) override;
63
64 Result<std::vector<Namespace>> ListNamespaces(const Namespace& ns) const override;
65
66 Result<std::unordered_map<std::string, std::string>> GetNamespaceProperties(
67 const Namespace& ns) const override;
68
69 Status DropNamespace(const Namespace& ns) override;
70
71 Result<bool> NamespaceExists(const Namespace& ns) const override;
72
73 Status UpdateNamespaceProperties(
74 const Namespace& ns, const std::unordered_map<std::string, std::string>& updates,
75 const std::unordered_set<std::string>& removals) override;
76
77 Result<std::vector<TableIdentifier>> ListTables(const Namespace& ns) const override;
78
79 Result<std::shared_ptr<Table>> CreateTable(
80 const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema,
81 const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order,
82 const std::string& location,
83 const std::unordered_map<std::string, std::string>& properties) override;
84
85 Result<std::shared_ptr<Table>> UpdateTable(
86 const TableIdentifier& identifier,
87 const std::vector<std::unique_ptr<TableRequirement>>& requirements,
88 const std::vector<std::unique_ptr<TableUpdate>>& updates) override;
89
90 Result<std::shared_ptr<Transaction>> StageCreateTable(
91 const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema,
92 const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order,
93 const std::string& location,
94 const std::unordered_map<std::string, std::string>& properties) override;
95
96 Result<bool> TableExists(const TableIdentifier& identifier) const override;
97
98 Status DropTable(const TableIdentifier& identifier, bool purge) override;
99
100 Status RenameTable(const TableIdentifier& from, const TableIdentifier& to) override;
101
102 Result<std::shared_ptr<Table>> LoadTable(const TableIdentifier& identifier) override;
103
104 Result<std::shared_ptr<Table>> RegisterTable(
105 const TableIdentifier& identifier,
106 const std::string& metadata_file_location) override;
107
108 private:
109 explicit HiveCatalog(HiveCatalogProperties config);
110
111 HiveCatalogProperties config_;
112 std::string name_;
113};
114
115} // namespace iceberg::hive
A Catalog API for table create, drop, and load operations.
Definition catalog.h:39
Configuration for the iceberg_hive HiveCatalog.
Definition hive_catalog_properties.h:47
Catalog implementation backed by a Hive Metastore.
Definition hive_catalog.h:42
Configuration for connecting to a Hive Metastore (HMS) over Thrift.
A namespace in a catalog.
Definition table_identifier.h:35
Identifies a table in iceberg catalog.
Definition table_identifier.h:46