Skip to content

Commit a11a619

Browse files
committed
refactor: use gcc-14 in ubuntu ci
1 parent ad14e5a commit a11a619

File tree

9 files changed

+57
-35
lines changed

9 files changed

+57
-35
lines changed

.devcontainer/Dockerfile.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ RUN apt update && \
2626
bash-completion \
2727
build-essential \
2828
ccache \
29+
clangd \
2930
cmake \
3031
curl \
31-
gcc \
32-
g++ \
32+
gcc-14 \
33+
g++-14 \
3334
git \
3435
htop \
3536
libboost-all-dev \

.github/workflows/cpp-linter.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
shell: bash
3737
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
3838
- name: Run build
39+
env:
40+
CC: gcc-14
41+
CXX: g++-14
3942
run: |
4043
mkdir build && cd build
4144
cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
@@ -45,6 +48,8 @@ jobs:
4548
continue-on-error: true
4649
env:
4750
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
CC: gcc-14
52+
CXX: g++-14
4853
with:
4954
style: file
5055
tidy-checks: ''

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
docs:
20-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-24.04
2121

2222
steps:
2323
- uses: actions/checkout@v6.0.0

.github/workflows/license_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on: pull_request
2222
jobs:
2323
license-check:
2424
name: "License Check"
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-24.04
2626
steps:
2727
- name: Checkout repository
2828
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

.github/workflows/rc.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions:
3030
jobs:
3131
archive:
3232
name: Archive
33-
runs-on: ubuntu-latest
33+
runs-on: ubuntu-24.04
3434
timeout-minutes: 5
3535
steps:
3636
- name: Checkout
@@ -77,6 +77,13 @@ jobs:
7777
- macos-26
7878
- ubuntu-24.04
7979
# - windows-latest
80+
include:
81+
- os: ubuntu-24.04
82+
CC: gcc-14
83+
CXX: g++-14
84+
env:
85+
CC: ${{ matrix.CC || 'cc' }}
86+
CXX: ${{ matrix.CXX || 'c++' }}
8087
steps:
8188
- name: Checkout
8289
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
@@ -109,7 +116,7 @@ jobs:
109116
if: github.ref_type == 'tag'
110117
needs:
111118
- verify
112-
runs-on: ubuntu-latest
119+
runs-on: ubuntu-24.04
113120
permissions:
114121
contents: write
115122
steps:

.github/workflows/sanitizer_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
shell: bash
4747
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
4848
- name: Configure and Build with ASAN & UBSAN
49+
env:
50+
CC: gcc-14
51+
CXX: g++-14
4952
run: |
5053
mkdir build && cd build
5154
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DICEBERG_ENABLE_ASAN=ON -DICEBERG_ENABLE_UBSAN=ON

.github/workflows/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ jobs:
5151
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
5252
- name: Build Iceberg
5353
shell: bash
54+
env:
55+
CC: gcc-14
56+
CXX: g++-14
5457
run: ci/scripts/build_iceberg.sh $(pwd)
5558
- name: Build Example
5659
shell: bash
60+
env:
61+
CC: gcc-14
62+
CXX: g++-14
5763
run: ci/scripts/build_example.sh $(pwd)/example
5864
macos:
5965
name: AArch64 macOS 26
@@ -102,11 +108,16 @@ jobs:
102108
include:
103109
- title: AMD64 Ubuntu 24.04
104110
runs-on: ubuntu-24.04
111+
CC: gcc-14
112+
CXX: g++-14
105113
- title: AMD64 Windows 2025
106114
runs-on: windows-2025
107115
meson-setup-args: --vsenv
108116
- title: AArch64 macOS 26
109117
runs-on: macos-26
118+
env:
119+
CC: ${{ matrix.CC || 'cc' }}
120+
CXX: ${{ matrix.CXX || 'c++' }}
110121
steps:
111122
- uses: actions/setup-python@v6
112123
with:

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ function(resolve_arrow_dependency)
9797
set(ARROW_WITH_ZLIB ON)
9898
set(ZLIB_SOURCE "SYSTEM")
9999
set(ARROW_VERBOSE_THIRDPARTY_BUILD OFF)
100+
set(CMAKE_CXX_STANDARD 17)
100101

101102
fetchcontent_declare(VendoredArrow
102103
${FC_DECLARE_COMMON_OPTIONS}

src/iceberg/table_metadata.cc

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <algorithm>
2323
#include <chrono>
2424
#include <format>
25+
#include <ranges>
2526
#include <string>
2627

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

185186
Result<TableMetadataCache::SchemasMap> TableMetadataCache::InitSchemasMap(
186187
const TableMetadata* metadata) {
187-
SchemasMap schemas_map;
188-
schemas_map.reserve(metadata->schemas.size());
189-
for (const auto& schema : metadata->schemas) {
190-
if (schema->schema_id()) {
191-
schemas_map.emplace(schema->schema_id().value(), schema);
192-
}
193-
}
194-
return schemas_map;
188+
return metadata->schemas | std::views::filter([](const auto& schema) {
189+
return schema->schema_id().has_value();
190+
}) |
191+
std::views::transform([](const auto& schema) {
192+
return std::make_pair(schema->schema_id().value(), schema);
193+
}) |
194+
std::ranges::to<SchemasMap>();
195195
}
196196

197197
Result<TableMetadataCache::PartitionSpecsMap> TableMetadataCache::InitPartitionSpecsMap(
198198
const TableMetadata* metadata) {
199-
PartitionSpecsMap partition_specs_map;
200-
partition_specs_map.reserve(metadata->partition_specs.size());
201-
for (const auto& spec : metadata->partition_specs) {
202-
partition_specs_map.emplace(spec->spec_id(), spec);
203-
}
204-
return partition_specs_map;
199+
return metadata->partition_specs | std::views::transform([](const auto& spec) {
200+
return std::make_pair(spec->spec_id(), spec);
201+
}) |
202+
std::ranges::to<PartitionSpecsMap>();
205203
}
206204

207205
Result<TableMetadataCache::SortOrdersMap> TableMetadataCache::InitSortOrdersMap(
208206
const TableMetadata* metadata) {
209-
SortOrdersMap sort_orders_map;
210-
sort_orders_map.reserve(metadata->sort_orders.size());
211-
for (const auto& order : metadata->sort_orders) {
212-
sort_orders_map.emplace(order->order_id(), order);
213-
}
214-
return sort_orders_map;
207+
return metadata->sort_orders | std::views::transform([](const auto& order) {
208+
return std::make_pair(order->order_id(), order);
209+
}) |
210+
std::ranges::to<SortOrdersMap>();
215211
}
216212

217213
Result<TableMetadataCache::SnapshotsMap> TableMetadataCache::InitSnapshotMap(
218214
const TableMetadata* metadata) {
219-
SnapshotsMap snapshots_map;
220-
snapshots_map.reserve(metadata->snapshots.size());
221-
for (const auto& snapshot : metadata->snapshots) {
222-
snapshots_map.emplace(snapshot->snapshot_id, snapshot);
223-
}
224-
return snapshots_map;
215+
return metadata->snapshots | std::views::transform([](const auto& snapshot) {
216+
return std::make_pair(snapshot->snapshot_id, snapshot);
217+
}) |
218+
std::ranges::to<SnapshotsMap>();
225219
}
226220

227221
// TableMetadataUtil implementation
228222

229223
Result<MetadataFileCodecType> TableMetadataUtil::CodecFromFileName(
230224
std::string_view file_name) {
231-
if (file_name.find(".metadata.json") == std::string::npos) {
225+
auto pos = file_name.find_last_of(".metadata.json");
226+
if (pos == std::string::npos) {
232227
return InvalidArgument("{} is not a valid metadata file", file_name);
233228
}
234229

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

240-
std::string_view file_name_without_suffix =
241-
file_name.substr(0, file_name.find_last_of(".metadata.json"));
235+
std::string_view file_name_without_suffix = file_name.substr(0, pos);
242236
if (file_name_without_suffix.ends_with(".gz")) {
243237
return MetadataFileCodecType::kGzip;
244238
}

0 commit comments

Comments
 (0)