-
Notifications
You must be signed in to change notification settings - Fork 111
feat(hive): add iceberg_hive library backed by Arrow bundled Thrift #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MisterRaindrop
wants to merge
1
commit into
apache:main
Choose a base branch
from
MisterRaindrop:feat/hive-thrift-codegen-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #include "iceberg/catalog/hive/hive_catalog.h" | ||
|
|
||
| #include <memory> | ||
| #include <utility> | ||
|
|
||
| #include "iceberg/util/macros.h" | ||
|
|
||
| namespace iceberg::hive { | ||
|
|
||
| namespace { | ||
|
|
||
| constexpr std::string_view kNotImplementedMessage = | ||
| "HiveCatalog method is not yet implemented."; | ||
|
|
||
| } // namespace | ||
|
|
||
| HiveCatalog::HiveCatalog(HiveCatalogProperties config) | ||
| : config_(std::move(config)), name_(config_.Get(HiveCatalogProperties::kName)) {} | ||
|
|
||
| HiveCatalog::~HiveCatalog() = default; | ||
|
|
||
| Result<std::shared_ptr<HiveCatalog>> HiveCatalog::Make( | ||
| const HiveCatalogProperties& config) { | ||
| ICEBERG_RETURN_UNEXPECTED(config.Uri()); | ||
| return std::shared_ptr<HiveCatalog>(new HiveCatalog(config)); | ||
| } | ||
|
|
||
| std::string_view HiveCatalog::name() const { return name_; } | ||
|
|
||
| Status HiveCatalog::CreateNamespace( | ||
| const Namespace& /*ns*/, | ||
| const std::unordered_map<std::string, std::string>& /*properties*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::vector<Namespace>> HiveCatalog::ListNamespaces( | ||
| const Namespace& /*ns*/) const { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::unordered_map<std::string, std::string>> HiveCatalog::GetNamespaceProperties( | ||
| const Namespace& /*ns*/) const { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Status HiveCatalog::DropNamespace(const Namespace& /*ns*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<bool> HiveCatalog::NamespaceExists(const Namespace& /*ns*/) const { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Status HiveCatalog::UpdateNamespaceProperties( | ||
| const Namespace& /*ns*/, | ||
| const std::unordered_map<std::string, std::string>& /*updates*/, | ||
| const std::unordered_set<std::string>& /*removals*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::vector<TableIdentifier>> HiveCatalog::ListTables( | ||
| const Namespace& /*ns*/) const { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::shared_ptr<Table>> HiveCatalog::CreateTable( | ||
| const TableIdentifier& /*identifier*/, const std::shared_ptr<Schema>& /*schema*/, | ||
| const std::shared_ptr<PartitionSpec>& /*spec*/, | ||
| const std::shared_ptr<SortOrder>& /*order*/, const std::string& /*location*/, | ||
| const std::unordered_map<std::string, std::string>& /*properties*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::shared_ptr<Table>> HiveCatalog::UpdateTable( | ||
| const TableIdentifier& /*identifier*/, | ||
| const std::vector<std::unique_ptr<TableRequirement>>& /*requirements*/, | ||
| const std::vector<std::unique_ptr<TableUpdate>>& /*updates*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::shared_ptr<Transaction>> HiveCatalog::StageCreateTable( | ||
| const TableIdentifier& /*identifier*/, const std::shared_ptr<Schema>& /*schema*/, | ||
| const std::shared_ptr<PartitionSpec>& /*spec*/, | ||
| const std::shared_ptr<SortOrder>& /*order*/, const std::string& /*location*/, | ||
| const std::unordered_map<std::string, std::string>& /*properties*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<bool> HiveCatalog::TableExists(const TableIdentifier& /*identifier*/) const { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Status HiveCatalog::DropTable(const TableIdentifier& /*identifier*/, bool /*purge*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Status HiveCatalog::RenameTable(const TableIdentifier& /*from*/, | ||
| const TableIdentifier& /*to*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::shared_ptr<Table>> HiveCatalog::LoadTable( | ||
| const TableIdentifier& /*identifier*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| Result<std::shared_ptr<Table>> HiveCatalog::RegisterTable( | ||
| const TableIdentifier& /*identifier*/, | ||
| const std::string& /*metadata_file_location*/) { | ||
| return NotImplemented("{}", kNotImplementedMessage); | ||
| } | ||
|
|
||
| } // namespace iceberg::hive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
| #include <unordered_set> | ||
|
|
||
| #include "iceberg/catalog.h" | ||
| #include "iceberg/catalog/hive/hive_catalog_properties.h" | ||
| #include "iceberg/catalog/hive/iceberg_hive_export.h" | ||
| #include "iceberg/result.h" | ||
|
|
||
| /// \file iceberg/catalog/hive/hive_catalog.h | ||
| /// \brief HiveCatalog implementation for talking to a Hive Metastore (HMS). | ||
|
|
||
| namespace iceberg::hive { | ||
|
|
||
| /// \brief Catalog implementation backed by a Hive Metastore. | ||
| /// | ||
| /// Currently a stub: every Catalog method returns | ||
| /// ErrorKind::kNotImplemented. Follow-up changes add the HMS Thrift client | ||
| /// and wire each method to the metastore. | ||
| class ICEBERG_HIVE_EXPORT HiveCatalog : public Catalog, | ||
| public std::enable_shared_from_this<HiveCatalog> { | ||
| public: | ||
| ~HiveCatalog() override; | ||
|
|
||
| HiveCatalog(const HiveCatalog&) = delete; | ||
| HiveCatalog& operator=(const HiveCatalog&) = delete; | ||
| HiveCatalog(HiveCatalog&&) = delete; | ||
| HiveCatalog& operator=(HiveCatalog&&) = delete; | ||
|
|
||
| /// \brief Construct a HiveCatalog from `config`. | ||
| /// | ||
| /// Only stores the configuration for now; HMS connection setup comes | ||
| /// with the Thrift client. Returns an error if the supplied | ||
| /// configuration is missing required fields (currently: the URI). | ||
| static Result<std::shared_ptr<HiveCatalog>> Make(const HiveCatalogProperties& config); | ||
|
|
||
| std::string_view name() const override; | ||
|
|
||
| Status CreateNamespace( | ||
| const Namespace& ns, | ||
| const std::unordered_map<std::string, std::string>& properties) override; | ||
|
|
||
| Result<std::vector<Namespace>> ListNamespaces(const Namespace& ns) const override; | ||
|
|
||
| Result<std::unordered_map<std::string, std::string>> GetNamespaceProperties( | ||
| const Namespace& ns) const override; | ||
|
|
||
| Status DropNamespace(const Namespace& ns) override; | ||
|
|
||
| Result<bool> NamespaceExists(const Namespace& ns) const override; | ||
|
|
||
| Status UpdateNamespaceProperties( | ||
| const Namespace& ns, const std::unordered_map<std::string, std::string>& updates, | ||
| const std::unordered_set<std::string>& removals) override; | ||
|
|
||
| Result<std::vector<TableIdentifier>> ListTables(const Namespace& ns) const override; | ||
|
|
||
| Result<std::shared_ptr<Table>> CreateTable( | ||
| const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema, | ||
| const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order, | ||
| const std::string& location, | ||
| const std::unordered_map<std::string, std::string>& properties) override; | ||
|
|
||
| Result<std::shared_ptr<Table>> UpdateTable( | ||
| const TableIdentifier& identifier, | ||
| const std::vector<std::unique_ptr<TableRequirement>>& requirements, | ||
| const std::vector<std::unique_ptr<TableUpdate>>& updates) override; | ||
|
|
||
| Result<std::shared_ptr<Transaction>> StageCreateTable( | ||
| const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema, | ||
| const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order, | ||
| const std::string& location, | ||
| const std::unordered_map<std::string, std::string>& properties) override; | ||
|
|
||
| Result<bool> TableExists(const TableIdentifier& identifier) const override; | ||
|
|
||
| Status DropTable(const TableIdentifier& identifier, bool purge) override; | ||
|
|
||
| Status RenameTable(const TableIdentifier& from, const TableIdentifier& to) override; | ||
|
|
||
| Result<std::shared_ptr<Table>> LoadTable(const TableIdentifier& identifier) override; | ||
|
|
||
| Result<std::shared_ptr<Table>> RegisterTable( | ||
| const TableIdentifier& identifier, | ||
| const std::string& metadata_file_location) override; | ||
|
|
||
| private: | ||
| explicit HiveCatalog(HiveCatalogProperties config); | ||
|
|
||
| HiveCatalogProperties config_; | ||
| std::string name_; | ||
| }; | ||
|
|
||
| } // namespace iceberg::hive |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend follow
resolve_aws_sdk_dependencyandICEBERG_AWSSDK_BUNDLEDto either bundle or use system thrift.