Skip to content

Commit 3f384c8

Browse files
committed
WIP: explore nanoarrow and sparrow
1 parent cd82335 commit 3f384c8

File tree

3 files changed

+86
-2
lines changed

3 files changed

+86
-2
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ jobs:
4848
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4949
with:
5050
fetch-depth: 0
51+
- name: Install Date Library
52+
shell: bash
53+
run: |
54+
sudo apt-get update
55+
sudo apt-get install -y libdate-dev
5156
- name: Build Iceberg
5257
shell: bash
5358
run: ci/scripts/build_iceberg.sh $(pwd)
@@ -65,6 +70,10 @@ jobs:
6570
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6671
with:
6772
fetch-depth: 0
73+
- name: Install Date Library
74+
shell: bash
75+
run: |
76+
brew install howard-hinnant-date
6877
- name: Build Iceberg
6978
shell: bash
7079
run: ci/scripts/build_iceberg.sh $(pwd)
@@ -80,10 +89,11 @@ jobs:
8089
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8190
with:
8291
fetch-depth: 0
83-
- name: Install ZLIB
92+
- name: Install ZLIB and Date Library
8493
shell: cmd
8594
run: |
8695
vcpkg install zlib:x64-windows
96+
vcpkg install date:x64-windows
8797
- name: Build Iceberg
8898
shell: cmd
8999
run: |

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,59 @@ endfunction()
198198
if(ICEBERG_AVRO)
199199
resolve_avro_dependency()
200200
endif()
201+
202+
# ----------------------------------------------------------------------
203+
# Nanoarrow
204+
205+
# It is also possible to vendor nanoarrow using the bundled source code.
206+
function(resolve_nanoarrow_dependency)
207+
prepare_fetchcontent()
208+
fetchcontent_declare(nanoarrow
209+
${FC_DECLARE_COMMON_OPTIONS}
210+
URL "https://dlcdn.apache.org/arrow/apache-arrow-nanoarrow-0.6.0/apache-arrow-nanoarrow-0.6.0.tar.gz"
211+
)
212+
fetchcontent_makeavailable(nanoarrow)
213+
214+
set_target_properties(nanoarrow PROPERTIES OUTPUT_NAME "iceberg_vendored_nanoarrow")
215+
install(TARGETS nanoarrow
216+
EXPORT iceberg_targets
217+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
218+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
219+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
220+
endfunction()
221+
222+
resolve_nanoarrow_dependency()
223+
224+
# ----------------------------------------------------------------------
225+
# Sparrow
226+
227+
function(resolve_sparrow_dependency)
228+
prepare_fetchcontent()
229+
230+
# Add the sparrow cmake module path to the CMAKE_MODULE_PATH
231+
# Otherwise we will see error below:
232+
# include could not find requested file: sanitizers
233+
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}/_deps/sparrow-src/cmake)
234+
235+
fetchcontent_declare(sparrow
236+
${FC_DECLARE_COMMON_OPTIONS}
237+
GIT_REPOSITORY https://github.com/man-group/sparrow.git
238+
GIT_TAG b0794cace22a55c32e90c0236034e040b822b957 # 0.3.0
239+
)
240+
fetchcontent_makeavailable(sparrow)
241+
242+
set_target_properties(sparrow PROPERTIES OUTPUT_NAME "iceberg_vendored_sparrow")
243+
install(TARGETS sparrow
244+
EXPORT iceberg_targets
245+
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
246+
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
247+
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
248+
249+
# sparrow depends on date::date and date::date-tz
250+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES date)
251+
set(ICEBERG_SYSTEM_DEPENDENCIES
252+
${ICEBERG_SYSTEM_DEPENDENCIES}
253+
PARENT_SCOPE)
254+
endfunction()
255+
256+
resolve_sparrow_dependency()

src/iceberg/CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,29 @@
1717

1818
set(ICEBERG_SOURCES demo_table.cc schema.cc schema_field.cc type.cc)
1919

20+
set(ICEBERG_STATIC_BUILD_INTERFACE_LIBS)
21+
set(ICEBERG_SHARED_BUILD_INTERFACE_LIBS)
22+
set(ICEBERG_STATIC_INSTALL_INTERFACE_LIBS)
23+
set(ICEBERG_SHARED_INSTALL_INTERFACE_LIBS)
24+
25+
list(APPEND ICEBERG_STATIC_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow sparrow)
26+
list(APPEND ICEBERG_SHARED_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow sparrow)
27+
list(APPEND ICEBERG_STATIC_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow" "Iceberg::sparrow")
28+
list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow" "Iceberg::sparrow")
29+
2030
add_iceberg_lib(iceberg
2131
SOURCES
2232
${ICEBERG_SOURCES}
2333
PRIVATE_INCLUDES
24-
${ICEBERG_INCLUDES})
34+
${ICEBERG_INCLUDES}
35+
SHARED_LINK_LIBS
36+
${ICEBERG_SHARED_BUILD_INTERFACE_LIBS}
37+
STATIC_LINK_LIBS
38+
${ICEBERG_STATIC_BUILD_INTERFACE_LIBS}
39+
STATIC_INSTALL_INTERFACE_LIBS
40+
${ICEBERG_STATIC_INSTALL_INTERFACE_LIBS}
41+
SHARED_INSTALL_INTERFACE_LIBS
42+
${ICEBERG_SHARED_INSTALL_INTERFACE_LIBS})
2543

2644
iceberg_install_all_headers(iceberg)
2745

0 commit comments

Comments
 (0)