From edf41e107d3b2d3034c1470f084f7456138dae8c Mon Sep 17 00:00:00 2001 From: MisterRaindrop <278811821@qq.com> Date: Tue, 19 May 2026 22:31:58 +0800 Subject: [PATCH] build(hive): add ICEBERG_BUILD_HIVE option and skeleton Introduce a top-level ICEBERG_BUILD_HIVE CMake option (default OFF) and wire src/iceberg/catalog/hive/ into the build as a subdirectory. The new directory installs only iceberg_hive_export.h for now and mirrors the iceberg_rest_export.h pattern so that follow-up commits can add sources without further layout changes. The default OFF keeps builds without Apache Thrift unaffected. README's CMake options table is updated. First commit (C01) of the iceberg-cpp HiveCatalog port that follows iceberg-rust's iceberg-catalog-hms crate as a blueprint. --- CMakeLists.txt | 1 + README.md | 1 + src/iceberg/catalog/CMakeLists.txt | 4 +++ src/iceberg/catalog/hive/CMakeLists.txt | 25 ++++++++++++++ .../catalog/hive/iceberg_hive_export.h | 34 +++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 src/iceberg/catalog/hive/CMakeLists.txt create mode 100644 src/iceberg/catalog/hive/iceberg_hive_export.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c0f2eb73f..38837aedd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ option(ICEBERG_BUILD_TESTS "Build tests" ON) option(ICEBERG_BUILD_BUNDLE "Build the battery included library" ON) option(ICEBERG_BUILD_REST "Build rest catalog client" ON) option(ICEBERG_BUILD_REST_INTEGRATION_TESTS "Build rest catalog integration tests" OFF) +option(ICEBERG_BUILD_HIVE "Build hive (HMS) catalog client" OFF) option(ICEBERG_S3 "Build with S3 support" OFF) option(ICEBERG_ENABLE_ASAN "Enable Address Sanitizer" OFF) option(ICEBERG_ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF) diff --git a/README.md b/README.md index 281987c3c..3d69a01fc 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ cmake --install build | `ICEBERG_BUILD_BUNDLE` | `ON` | Build the battery-included library | | `ICEBERG_BUILD_REST` | `ON` | Build REST catalog client | | `ICEBERG_BUILD_REST_INTEGRATION_TESTS` | `OFF` | Build REST catalog integration tests | +| `ICEBERG_BUILD_HIVE` | `OFF` | Build Hive (HMS) catalog client | | `ICEBERG_ENABLE_ASAN` | `OFF` | Enable Address Sanitizer | | `ICEBERG_ENABLE_UBSAN` | `OFF` | Enable Undefined Behavior Sanitizer | diff --git a/src/iceberg/catalog/CMakeLists.txt b/src/iceberg/catalog/CMakeLists.txt index 13cdb0949..0b288e260 100644 --- a/src/iceberg/catalog/CMakeLists.txt +++ b/src/iceberg/catalog/CMakeLists.txt @@ -20,3 +20,7 @@ add_subdirectory(memory) if(ICEBERG_BUILD_REST) add_subdirectory(rest) endif() + +if(ICEBERG_BUILD_HIVE) + add_subdirectory(hive) +endif() diff --git a/src/iceberg/catalog/hive/CMakeLists.txt b/src/iceberg/catalog/hive/CMakeLists.txt new file mode 100644 index 000000000..0dee1ad10 --- /dev/null +++ b/src/iceberg/catalog/hive/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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. + +# Skeleton for the iceberg_hive library target. +# +# Sources, dependency wiring and the actual `iceberg_hive` library target +# are introduced in follow-up commits. For now this file installs only the +# public export header so that the directory is wired into the build system +# end-to-end. + +iceberg_install_all_headers(iceberg/catalog/hive) diff --git a/src/iceberg/catalog/hive/iceberg_hive_export.h b/src/iceberg/catalog/hive/iceberg_hive_export.h new file mode 100644 index 000000000..229304553 --- /dev/null +++ b/src/iceberg/catalog/hive/iceberg_hive_export.h @@ -0,0 +1,34 @@ +/* + * 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 + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifdef ICEBERG_HIVE_STATIC +# define ICEBERG_HIVE_EXPORT +# elif defined(ICEBERG_HIVE_EXPORTING) +# define ICEBERG_HIVE_EXPORT __declspec(dllexport) +# else +# define ICEBERG_HIVE_EXPORT __declspec(dllimport) +# endif +#else // Not Windows +# ifndef ICEBERG_HIVE_EXPORT +# define ICEBERG_HIVE_EXPORT __attribute__((visibility("default"))) +# endif +#endif