Skip to content

Commit 40cc992

Browse files
feat(hive): vendor Hive Metastore IDL and generated bindings (#749)
- Update vendored Hive Metastore IDL to Hive 4.0.1. - Check in generated HMS/fb303 C++ bindings. - Add a regeneration script plus lint/license exclusions for generated sources.
1 parent 1777794 commit 40cc992

16 files changed

Lines changed: 248184 additions & 140 deletions

.github/.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ header:
3131
- 'requirements.txt'
3232
- 'src/iceberg/util/murmurhash3_internal.*'
3333
- 'src/iceberg/test/resources/**'
34+
- 'src/iceberg/catalog/hive/gen-cpp/**'
3435
- 'thirdparty/**'
3536

3637
comment: on-failure

.github/workflows/cpp-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
files-changed-only: true
6969
lines-changed-only: true
7070
thread-comments: true
71-
ignore: 'build|cmake_modules|ci'
71+
ignore: 'build|cmake_modules|ci|src/iceberg/catalog/hive/gen-cpp'
7272
database: build
7373
verbosity: 'debug'
7474
# need '-fno-builtin-std-forward_like', see https://github.com/llvm/llvm-project/issues/101614

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ repos:
2525
rev: v5.0.0
2626
hooks:
2727
- id: trailing-whitespace
28+
exclude: ^src/iceberg/catalog/hive/gen-cpp/
2829
- id: end-of-file-fixer
30+
exclude: ^src/iceberg/catalog/hive/gen-cpp/
2931
- id: check-yaml
3032
- id: check-added-large-files
33+
exclude: ^src/iceberg/catalog/hive/gen-cpp/
3134

3235
- repo: https://github.com/pre-commit/mirrors-clang-format
3336
rev: v20.1.8
3437
hooks:
3538
- id: clang-format
3639
exclude_types: [json]
40+
exclude: ^src/iceberg/catalog/hive/gen-cpp/
3741

3842
- repo: https://github.com/cheshirekow/cmake-format-precommit
3943
rev: v0.6.10

dev/update_hive_thrift.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
# Regenerate the committed Hive Metastore C++ bindings from the vendored
21+
# Thrift IDL. Run this whenever thirdparty/hive_metastore/*.thrift changes.
22+
# Requires the Apache Thrift IDL compiler ("thrift") on PATH; the generated
23+
# sources are checked in so a normal build needs no Thrift compiler.
24+
25+
set -euo pipefail
26+
27+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
28+
idl_dir="${repo_root}/thirdparty/hive_metastore"
29+
out_dir="${repo_root}/src/iceberg/catalog/hive/gen-cpp"
30+
31+
if ! command -v thrift >/dev/null 2>&1; then
32+
echo "error: 'thrift' IDL compiler not found on PATH" >&2
33+
echo " install it (e.g. 'brew install thrift' or 'apt install thrift-compiler')" >&2
34+
exit 1
35+
fi
36+
37+
rm -rf "${out_dir}"
38+
mkdir -p "${out_dir}"
39+
40+
# -r recurses into included IDL (fb303); cpp:no_skeleton omits server stubs.
41+
thrift -r --gen cpp:no_skeleton -out "${out_dir}" \
42+
-I "${idl_dir}" "${idl_dir}/hive_metastore.thrift"
43+
44+
echo "Regenerated Hive Metastore bindings in ${out_dir}"
45+
echo "Review the diff and commit the result."

0 commit comments

Comments
 (0)