Skip to content

Commit ca4210f

Browse files
authored
Merge pull request #2717 from sinistersnare/feature/zstd-decompression
Zstd decompression for arrows
2 parents e179382 + c084c96 commit ca4210f

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

cmake/arrow/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ set(ARROW_SRCS
9090
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/byte_size.cc
9191
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/cancel.cc
9292
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/compression.cc
93-
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/compression_zstd.cc
93+
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/compression_zstd.cc
9494
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/compression_lz4.cc
9595
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/counting_semaphore.cc
9696
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/debug.cc
@@ -154,11 +154,11 @@ set(ARROW_SRCS
154154
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec.cc
155155
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/expression.cc
156156
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/function.cc
157-
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/function_internal.cc
157+
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/function_internal.cc
158158
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernel.cc
159159
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/ordering.cc
160160

161-
161+
162162
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/registry.cc
163163
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_basic.cc
164164
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_mode.cc
@@ -278,16 +278,19 @@ add_library(arrow STATIC ${ARROW_SRCS})
278278

279279
target_compile_definitions(arrow PUBLIC ARROW_NO_DEPRECATED_API)
280280
target_compile_definitions(arrow PUBLIC ARROW_STATIC)
281-
# target_compile_definitions(arrow PUBLIC ARROW_WITH_ZSTD=ON)
281+
target_compile_definitions(arrow PUBLIC ARROW_WITH_ZSTD=ON)
282282
target_compile_definitions(arrow PUBLIC ARROW_WITH_LZ4)
283283

284+
target_include_directories(arrow SYSTEM PRIVATE ${zstd_SOURCE_DIR}/lib)
285+
284286
# will need built boost filesystem and system .lib to work, even though
285287
# perspective itself does not use those dependencies
286288
target_link_libraries(arrow
287289
${double-conversion_LIBRARIES}
288290
${Boost_FILESYSTEM_LIBRARY}
289291
${Boost_SYSTEM_LIBRARY}
290292
lz4_static
293+
libzstd_static
291294
${ARROW_TEST_LINK_TOOLCHAIN})
292295

293296
# find_package(Flatbuffers)

cmake/modules/FindInstallDependency.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function(psp_build_dep name cmake_file)
1212
else()
1313
configure_file(${cmake_file} ${CMAKE_BINARY_DIR}/${name}-download/CMakeLists.txt)
1414
set(_cwd ${CMAKE_BINARY_DIR}/${name}-download)
15-
15+
1616
message(STATUS "Configuring ${name} in ${_cwd}")
1717

1818
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
@@ -24,7 +24,7 @@ function(psp_build_dep name cmake_file)
2424
if(result)
2525
message(FATAL_ERROR "CMake step for ${name} failed:\nSTDOUT:${cmd_output}\nSTDERR: ${cmd_error}")
2626
endif()
27-
27+
2828
message("${cmd_output}")
2929

3030
execute_process(COMMAND ${CMAKE_COMMAND} --build .

cpp/perspective/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,22 @@ psp_build_dep("date" "${PSP_CMAKE_MODULE_PATH}/date.txt.in")
424424
psp_build_dep("hopscotch" "${PSP_CMAKE_MODULE_PATH}/hopscotch.txt.in")
425425
psp_build_dep("ordered-map" "${PSP_CMAKE_MODULE_PATH}/ordered-map.txt.in")
426426

427+
# ExternalProject_Add was not working for zstd, SOURCE_SUBDIR was not being honored.
428+
include(FetchContent)
429+
430+
set(ZSTD_BUILD_STATIC ON)
431+
set(ZSTD_BUILD_SHARED OFF)
432+
set(ZSTD_BUILD_COMPRESSION OFF)
433+
434+
FetchContent_Declare(
435+
zstd
436+
URL "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz"
437+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
438+
SOURCE_SUBDIR build/cmake
439+
)
440+
441+
FetchContent_MakeAvailable(zstd)
442+
427443
# Build minimal arrow for both Emscripten and Python
428444
psp_build_message("${Cyan}Building minimal Apache Arrow${ColorReset}")
429445

@@ -733,4 +749,4 @@ endif()
733749

734750
if(NOT WIN32)
735751
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
736-
endif()
752+
endif()

0 commit comments

Comments
 (0)