Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ RUN apt update && \
bash-completion \
build-essential \
ccache \
clangd \
cmake \
curl \
gcc \
g++ \
gcc-14 \
g++-14 \
git \
htop \
libboost-all-dev \
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
shell: bash
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Run build
env:
CC: gcc-14
CXX: g++-14
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
Expand All @@ -54,7 +57,8 @@ jobs:
thread-comments: true
ignore: 'build|cmake_modules|ci'
database: build
extra-args: '-I$PWD/src -I$PWD/build/src'
# need '-fno-builtin-std-forward_like', see https://github.com/llvm/llvm-project/issues/101614
extra-args: '-I$PWD/src -I$PWD/build/src -fno-builtin-std-forward_like'
- name: Fail fast?!
if: steps.linter.outputs.checks-failed != 0
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

jobs:
docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v6.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on: pull_request
jobs:
license-check:
name: "License Check"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ permissions:
jobs:
archive:
name: Archive
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
Expand Down Expand Up @@ -77,6 +77,10 @@ jobs:
- macos-26
- ubuntu-24.04
# - windows-latest
include:
- os: ubuntu-24.04
CC: gcc-14
CXX: g++-14
steps:
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
Expand All @@ -85,6 +89,12 @@ jobs:
with:
name: archive

- name: Set Ubuntu Compilers
if: ${{ startsWith(matrix.runs-on, 'ubuntu') }}
run: |
echo "CC=${{ matrix.CC }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.CXX }}" >> $GITHUB_ENV

- name: Verify
run: |
tar_gz=$(echo apache-iceberg-cpp-*.tar.gz)
Expand All @@ -109,7 +119,7 @@ jobs:
if: github.ref_type == 'tag'
needs:
- verify
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/sanitizer_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
shell: bash
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Configure and Build with ASAN & UBSAN
env:
CC: gcc-14
CXX: g++-14
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DICEBERG_ENABLE_ASAN=ON -DICEBERG_ENABLE_UBSAN=ON
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build Iceberg
shell: bash
env:
CC: gcc-14
CXX: g++-14
run: ci/scripts/build_iceberg.sh $(pwd)
- name: Build Example
shell: bash
env:
CC: gcc-14
CXX: g++-14
run: ci/scripts/build_example.sh $(pwd)/example
macos:
name: AArch64 macOS 26
Expand Down Expand Up @@ -102,6 +108,8 @@ jobs:
include:
- title: AMD64 Ubuntu 24.04
runs-on: ubuntu-24.04
CC: gcc-14
CXX: g++-14
- title: AMD64 Windows 2025
runs-on: windows-2025
meson-setup-args: --vsenv
Expand All @@ -117,6 +125,11 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Set Ubuntu Compilers
if: ${{ startsWith(matrix.runs-on, 'ubuntu') }}
run: |
echo "CC=${{ matrix.CC }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.CXX }}" >> $GITHUB_ENV
- name: Build Iceberg
run: |
meson setup builddir ${{ matrix.meson-setup-args || '' }}
Expand Down
5 changes: 3 additions & 2 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function(resolve_arrow_dependency)
set(ARROW_WITH_ZLIB ON)
set(ZLIB_SOURCE "SYSTEM")
set(ARROW_VERBOSE_THIRDPARTY_BUILD OFF)
set(CMAKE_CXX_STANDARD 17)

fetchcontent_declare(VendoredArrow
${FC_DECLARE_COMMON_OPTIONS}
Expand Down Expand Up @@ -323,7 +324,7 @@ function(resolve_croaring_dependency)
set(CROARING_URL "$ENV{ICEBERG_CROARING_URL}")
else()
set(CROARING_URL
"https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.3.11.tar.gz")
"https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.4.3.tar.gz")
endif()

fetchcontent_declare(croaring
Expand Down Expand Up @@ -542,7 +543,7 @@ function(resolve_cpr_dependency)
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES OpenSSL)
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES OpenSSL CURL)
else()
set(CPR_VENDORED FALSE)
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES cpr)
Expand Down
13 changes: 0 additions & 13 deletions src/iceberg/iceberg-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ endmacro()
# Find system dependencies
iceberg_find_dependencies("${ICEBERG_SYSTEM_DEPENDENCIES}")

# Create missing CRoaring targets if they don't exist
if(NOT TARGET roaring::roaring-headers)
add_library(roaring::roaring-headers INTERFACE IMPORTED)
endif()

if(NOT TARGET roaring::roaring-headers-cpp)
add_library(roaring::roaring-headers-cpp INTERFACE IMPORTED)
endif()

if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl INTERFACE IMPORTED)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/iceberg-targets.cmake")

if(TARGET iceberg::arrow_static)
Expand Down
52 changes: 23 additions & 29 deletions src/iceberg/table_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <algorithm>
#include <chrono>
#include <format>
#include <ranges>
#include <string>

#include <nlohmann/json.hpp>
Expand Down Expand Up @@ -184,51 +185,45 @@ Result<TableMetadataCache::SnapshotsMapRef> TableMetadataCache::GetSnapshotsById

Result<TableMetadataCache::SchemasMap> TableMetadataCache::InitSchemasMap(
const TableMetadata* metadata) {
SchemasMap schemas_map;
schemas_map.reserve(metadata->schemas.size());
for (const auto& schema : metadata->schemas) {
if (schema->schema_id()) {
schemas_map.emplace(schema->schema_id().value(), schema);
}
}
return schemas_map;
return metadata->schemas | std::views::filter([](const auto& schema) {
return schema->schema_id().has_value();
}) |
std::views::transform([](const auto& schema) {
return std::make_pair(schema->schema_id().value(), schema);
}) |
std::ranges::to<SchemasMap>();
}

Result<TableMetadataCache::PartitionSpecsMap> TableMetadataCache::InitPartitionSpecsMap(
const TableMetadata* metadata) {
PartitionSpecsMap partition_specs_map;
partition_specs_map.reserve(metadata->partition_specs.size());
for (const auto& spec : metadata->partition_specs) {
partition_specs_map.emplace(spec->spec_id(), spec);
}
return partition_specs_map;
return metadata->partition_specs | std::views::transform([](const auto& spec) {
return std::make_pair(spec->spec_id(), spec);
}) |
std::ranges::to<PartitionSpecsMap>();
}

Result<TableMetadataCache::SortOrdersMap> TableMetadataCache::InitSortOrdersMap(
const TableMetadata* metadata) {
SortOrdersMap sort_orders_map;
sort_orders_map.reserve(metadata->sort_orders.size());
for (const auto& order : metadata->sort_orders) {
sort_orders_map.emplace(order->order_id(), order);
}
return sort_orders_map;
return metadata->sort_orders | std::views::transform([](const auto& order) {
return std::make_pair(order->order_id(), order);
}) |
std::ranges::to<SortOrdersMap>();
}

Result<TableMetadataCache::SnapshotsMap> TableMetadataCache::InitSnapshotMap(
const TableMetadata* metadata) {
SnapshotsMap snapshots_map;
snapshots_map.reserve(metadata->snapshots.size());
for (const auto& snapshot : metadata->snapshots) {
snapshots_map.emplace(snapshot->snapshot_id, snapshot);
}
return snapshots_map;
return metadata->snapshots | std::views::transform([](const auto& snapshot) {
return std::make_pair(snapshot->snapshot_id, snapshot);
}) |
std::ranges::to<SnapshotsMap>();
}

// TableMetadataUtil implementation

Result<MetadataFileCodecType> TableMetadataUtil::CodecFromFileName(
std::string_view file_name) {
if (file_name.find(".metadata.json") == std::string::npos) {
auto pos = file_name.find_last_of(".metadata.json");
if (pos == std::string::npos) {
return InvalidArgument("{} is not a valid metadata file", file_name);
}

Expand All @@ -237,8 +232,7 @@ Result<MetadataFileCodecType> TableMetadataUtil::CodecFromFileName(
return MetadataFileCodecType::kGzip;
}

std::string_view file_name_without_suffix =
file_name.substr(0, file_name.find_last_of(".metadata.json"));
std::string_view file_name_without_suffix = file_name.substr(0, pos);
if (file_name_without_suffix.ends_with(".gz")) {
return MetadataFileCodecType::kGzip;
}
Expand Down
Loading