Skip to content

Commit aa35ed0

Browse files
authored
Merge branch 'main' into feature/register-table
2 parents e01f0fd + be514fc commit aa35ed0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1234
-4016
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ project(Iceberg
2828
DESCRIPTION "Iceberg C++ Project"
2929
LANGUAGES CXX)
3030

31-
set(CMAKE_CXX_STANDARD 20)
31+
set(CMAKE_CXX_STANDARD 23)
3232
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3333
set(CMAKE_CXX_EXTENSIONS OFF)
3434
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

LICENSE

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -202,34 +202,6 @@
202202

203203
--------------------------------------------------------------------------------
204204

205-
The file src/iceberg/expected.h contains code adapted from
206-
207-
https://github.com/zeus-cpp/expected
208-
209-
with the following license (MIT)
210-
211-
Copyright (c) 2024 zeus-cpp
212-
213-
Permission is hereby granted, free of charge, to any person obtaining a copy
214-
of this software and associated documentation files (the "Software"), to deal
215-
in the Software without restriction, including without limitation the rights
216-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
217-
copies of the Software, and to permit persons to whom the Software is
218-
furnished to do so, subject to the following conditions:
219-
220-
The above copyright notice and this permission notice shall be included in all
221-
copies or substantial portions of the Software.
222-
223-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
224-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
225-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
226-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
227-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
228-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
229-
SOFTWARE.
230-
231-
--------------------------------------------------------------------------------
232-
233205
3rdparty dependency nlohmann-json is statically linked in certain binary
234206
distributions. nlohmann-json has the following license:
235207

NOTICE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ Copyright 2024-2025 The Apache Software Foundation
44
This product includes software developed at
55
The Apache Software Foundation (http://www.apache.org/).
66

7-
This product includes code from zeus-cpp
8-
* Copyright (c) 2024 zeus-cpp
9-
* https://github.com/zeus-cpp/expected
10-
117
This product includes code from smhasher
128
* MurmurHash3 was written by Austin Appleby, and is placed in the public
139
* domain. The author hereby disclaims copyright to this source code.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ C++ implementation of [Apache Iceberg™](https://iceberg.apache.org/).
2424
## Requirements
2525

2626
- CMake 3.25 or higher
27-
- C++20 compliant compiler
27+
- C++23 compliant compiler
2828

2929
## Build
3030

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function(resolve_arrow_dependency)
9999
fetchcontent_declare(VendoredArrow
100100
${FC_DECLARE_COMMON_OPTIONS}
101101
GIT_REPOSITORY https://github.com/apache/arrow.git
102-
GIT_TAG 5f0aeb5de53fb25b59a52661a80071faef99a4a4
102+
GIT_TAG f12356adaaabea86638407e995e73215dbb58bb2
103103
#URL ${ARROW_SOURCE_URL}
104104
#URL_HASH "SHA256=${ICEBERG_ARROW_BUILD_SHA256_CHECKSUM}"
105105
SOURCE_SUBDIR
@@ -282,6 +282,55 @@ function(resolve_nlohmann_json_dependency)
282282
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
283283
endfunction()
284284

285+
# ----------------------------------------------------------------------
286+
# spdlog
287+
288+
function(resolve_spdlog_dependency)
289+
prepare_fetchcontent()
290+
291+
find_package(Threads REQUIRED)
292+
293+
set(SPDLOG_USE_STD_FORMAT
294+
ON
295+
CACHE BOOL "" FORCE)
296+
set(SPDLOG_BUILD_PIC
297+
ON
298+
CACHE BOOL "" FORCE)
299+
300+
fetchcontent_declare(spdlog
301+
${FC_DECLARE_COMMON_OPTIONS}
302+
URL "https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.tar.gz"
303+
FIND_PACKAGE_ARGS
304+
NAMES
305+
spdlog
306+
CONFIG)
307+
fetchcontent_makeavailable(spdlog)
308+
309+
if(spdlog_SOURCE_DIR)
310+
set_target_properties(spdlog PROPERTIES OUTPUT_NAME "iceberg_vendored_spdlog"
311+
POSITION_INDEPENDENT_CODE ON)
312+
target_link_libraries(spdlog INTERFACE Threads::Threads)
313+
install(TARGETS spdlog
314+
EXPORT iceberg_targets
315+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
316+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
317+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
318+
set(SPDLOG_VENDORED TRUE)
319+
else()
320+
set(SPDLOG_VENDORED FALSE)
321+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES spdlog)
322+
endif()
323+
324+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Threads)
325+
326+
set(ICEBERG_SYSTEM_DEPENDENCIES
327+
${ICEBERG_SYSTEM_DEPENDENCIES}
328+
PARENT_SCOPE)
329+
set(SPDLOG_VENDORED
330+
${SPDLOG_VENDORED}
331+
PARENT_SCOPE)
332+
endfunction()
333+
285334
# ----------------------------------------------------------------------
286335
# zlib
287336

@@ -299,11 +348,27 @@ function(resolve_zlib_dependency)
299348

300349
endfunction()
301350

351+
# ----------------------------------------------------------------------
352+
# Zstd
353+
354+
function(resolve_zstd_dependency)
355+
find_package(zstd CONFIG)
356+
if(zstd_FOUND)
357+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES zstd)
358+
message(STATUS "Found zstd, version: ${zstd_VERSION}")
359+
set(ICEBERG_SYSTEM_DEPENDENCIES
360+
${ICEBERG_SYSTEM_DEPENDENCIES}
361+
PARENT_SCOPE)
362+
endif()
363+
endfunction()
364+
302365
resolve_zlib_dependency()
303366
resolve_nanoarrow_dependency()
304367
resolve_nlohmann_json_dependency()
368+
resolve_spdlog_dependency()
305369

306370
if(ICEBERG_BUILD_BUNDLE)
307371
resolve_arrow_dependency()
308372
resolve_avro_dependency()
373+
resolve_zstd_dependency()
309374
endif()

example/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 3.25)
2020

2121
project(example)
2222

23-
set(CMAKE_CXX_STANDARD 20)
23+
set(CMAKE_CXX_STANDARD 23)
2424

2525
find_package(Iceberg CONFIG REQUIRED)
2626

example/demo_example.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
#include <iostream>
2121

22-
#include "iceberg/arrow/demo_arrow.h"
23-
#include "iceberg/avro/demo_avro.h"
24-
#include "iceberg/demo.h"
22+
#include "iceberg/avro/avro_reader.h"
23+
#include "iceberg/file_reader.h"
2524

2625
int main() {
27-
std::cout << iceberg::Demo().print() << std::endl;
28-
std::cout << iceberg::arrow::DemoArrow().print() << std::endl;
29-
std::cout << iceberg::avro::DemoAvro().print() << std::endl;
26+
iceberg::avro::AvroReader::Register();
27+
auto open_result = iceberg::ReaderFactoryRegistry::Open(
28+
iceberg::FileFormatType::kAvro, {.path = "non-existing-file.avro"});
29+
if (!open_result.has_value()) {
30+
std::cerr << "Failed to open avro file" << std::endl;
31+
return 1;
32+
}
3033
return 0;
3134
}

src/iceberg/CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ set(ICEBERG_INCLUDES "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/src>"
2020
set(ICEBERG_SOURCES
2121
arrow_c_data_internal.cc
2222
catalog/in_memory_catalog.cc
23-
demo.cc
2423
expression/expression.cc
2524
expression/literal.cc
2625
file_reader.cc
@@ -41,12 +40,12 @@ set(ICEBERG_SOURCES
4140
statistics_file.cc
4241
table.cc
4342
table_metadata.cc
43+
table_scan.cc
4444
transform.cc
4545
transform_function.cc
4646
type.cc
4747
util/murmurhash3_internal.cc
4848
util/timepoint.cc
49-
util/unreachable.cc
5049
util/gzip_internal.cc)
5150

5251
set(ICEBERG_STATIC_BUILD_INTERFACE_LIBS)
@@ -58,16 +57,24 @@ list(APPEND
5857
ICEBERG_STATIC_BUILD_INTERFACE_LIBS
5958
nanoarrow::nanoarrow
6059
nlohmann_json::nlohmann_json
60+
spdlog::spdlog
6161
ZLIB::ZLIB)
6262
list(APPEND
6363
ICEBERG_SHARED_BUILD_INTERFACE_LIBS
6464
nanoarrow::nanoarrow
6565
nlohmann_json::nlohmann_json
66+
spdlog::spdlog
6667
ZLIB::ZLIB)
67-
list(APPEND ICEBERG_STATIC_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow"
68-
"Iceberg::nlohmann_json")
69-
list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow"
70-
"Iceberg::nlohmann_json")
68+
list(APPEND
69+
ICEBERG_STATIC_INSTALL_INTERFACE_LIBS
70+
"Iceberg::nanoarrow"
71+
"Iceberg::nlohmann_json"
72+
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>")
73+
list(APPEND
74+
ICEBERG_SHARED_INSTALL_INTERFACE_LIBS
75+
"Iceberg::nanoarrow"
76+
"Iceberg::nlohmann_json"
77+
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>")
7178

7279
add_iceberg_lib(iceberg
7380
SOURCES
@@ -94,9 +101,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_export.h
94101

95102
if(ICEBERG_BUILD_BUNDLE)
96103
set(ICEBERG_BUNDLE_SOURCES
97-
arrow/demo_arrow.cc
98104
arrow/arrow_fs_file_io.cc
99-
avro/demo_avro.cc
100105
avro/avro_data_util.cc
101106
avro/avro_reader.cc
102107
avro/avro_schema_util.cc

src/iceberg/arrow/arrow_error_transform_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ inline ErrorKind ToErrorKind(const ::arrow::Status& status) {
3838
#define ICEBERG_ARROW_ASSIGN_OR_RETURN_IMPL(result_name, lhs, rexpr, error_transform) \
3939
auto&& result_name = (rexpr); \
4040
if (!result_name.ok()) { \
41-
return unexpected<Error>{{.kind = error_transform(result_name.status()), \
42-
.message = result_name.status().ToString()}}; \
41+
return std::unexpected<Error>{{.kind = error_transform(result_name.status()), \
42+
.message = result_name.status().ToString()}}; \
4343
} \
4444
lhs = std::move(result_name).ValueOrDie();
4545

@@ -51,7 +51,7 @@ inline ErrorKind ToErrorKind(const ::arrow::Status& status) {
5151
do { \
5252
auto&& _status = (expr); \
5353
if (!_status.ok()) { \
54-
return unexpected<Error>{ \
54+
return std::unexpected<Error>{ \
5555
{.kind = ToErrorKind(_status), .message = _status.ToString()}}; \
5656
} \
5757
} while (0)

src/iceberg/arrow/demo_arrow.cc

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)