Skip to content

Commit 47f6cbe

Browse files
authored
Merge pull request #2749 from finos/arrow-17
Upgrade Apache Arrow C++ to 17.0.0
2 parents fc554a9 + aa83996 commit 47f6cbe

File tree

20 files changed

+75
-5604
lines changed

20 files changed

+75
-5604
lines changed

cmake/arrow.txt.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ project(arrow-download NONE)
1010
include(ExternalProject)
1111
ExternalProject_Add(apachearrow
1212
GIT_REPOSITORY https://github.com/apache/arrow.git
13-
GIT_TAG apache-arrow-12.0.0
13+
GIT_TAG apache-arrow-17.0.0
1414
SOURCE_DIR "${CMAKE_BINARY_DIR}/arrow-src"
1515
BINARY_DIR "${CMAKE_BINARY_DIR}/arrow-build"
16+
SOURCE_SUBDIR "cpp"
1617
CONFIGURE_COMMAND ""
1718
BUILD_COMMAND ""
1819
INSTALL_COMMAND ""

cmake/arrow/CMakeLists.txt

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

cmake/arrow/config.h

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

cmake/flatbuffers.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(flatbuffers-download NONE)
55
include(ExternalProject)
66
ExternalProject_Add(flatbuffers
77
GIT_REPOSITORY https://github.com/google/flatbuffers.git
8-
GIT_TAG v2.0.5
8+
GIT_TAG v23.5.26
99
SOURCE_DIR "${CMAKE_BINARY_DIR}/flatbuffers-src"
1010
BINARY_DIR "${CMAKE_BINARY_DIR}/flatbuffers-build"
1111
CONFIGURE_COMMAND ""

cmake/modules/FindFlatbuffers.cmake

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

cmake/modules/FindInstallDependency.cmake

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,27 @@ function(psp_build_dep name cmake_file)
3737
endif()
3838

3939
if(${name} STREQUAL arrow)
40-
# Overwrite arrow's CMakeLists with our custom, minimal CMakeLists.
41-
configure_file(${PSP_CMAKE_MODULE_PATH}/${name}/CMakeLists.txt ${CMAKE_BINARY_DIR}/${name}-src/cpp/ COPYONLY)
42-
configure_file(${PSP_CMAKE_MODULE_PATH}/${name}/config.h ${CMAKE_BINARY_DIR}/${name}-src/cpp/src/arrow/util/ COPYONLY)
40+
set(ARROW_SIMD_LEVEL "NONE")
41+
set(ARROW_DEFINE_OPTIONS ON)
42+
set(ARROW_RUNTIME_SIMD_LEVEL "NONE")
43+
set(ARROW_BUILD_SHARED OFF)
44+
set(ARROW_BUILD_STATIC ON)
45+
set(ARROW_BUILD_INTEGRATION OFF)
46+
set(ARROW_JEMALLOC OFF)
47+
set(ARROW_CSV ON)
48+
set(ARROW_LZ4 ON)
49+
set(ARROW_WITH_ZSTD ON)
50+
set(ARROW_WITH_LZ4 ON)
51+
set(ARROW_ENABLE_THREADING OFF)
52+
set(ARROW_NO_EXPORT ON)
53+
if(WIN32 AND NOT PSP_BUILD_WASM)
54+
set(ARROW_DEPENDENCY_SOURCE "BUNDLED")
55+
endif()
56+
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/${name}-build/src)
4357
add_subdirectory(${CMAKE_BINARY_DIR}/${name}-src/cpp/
4458
${CMAKE_BINARY_DIR}/${name}-build
45-
EXCLUDE_FROM_ALL)
59+
EXCLUDE_FROM_ALL
60+
)
4661

4762
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/${name}-src/cpp/src/)
4863
elseif(${name} STREQUAL exprtk)
@@ -78,7 +93,7 @@ function(psp_build_dep name cmake_file)
7893
endif()
7994

8095
if(NOT PSP_WASM_BUILD AND (MACOS OR NOT MANYLINUX))
81-
if(${name} STREQUAL arrow OR ${name} STREQUAL flatbuffers OR ${name} STREQUAL double-conversion OR ${name} STREQUAL re2)
96+
if(${name} STREQUAL arrow_static OR ${name} STREQUAL flatbuffers OR ${name} STREQUAL double-conversion OR ${name} STREQUAL re2)
8297
target_compile_options(${name} PRIVATE -fvisibility=hidden)
8398
endif()
8499
endif()

cpp/perspective/CMakeLists.txt

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
277277
-fexceptions \
278278
-g3 \
279279
")
280-
if (PSP_WASM_EXCEPTIONS)
281-
set(OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions ")
282-
endif()
280+
if (PSP_WASM_EXCEPTIONS)
281+
set(OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions ")
282+
endif()
283283
endif ()
284284
else()
285285
set(OPT_FLAGS " \
@@ -299,22 +299,11 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
299299
if(PSP_PYODIDE)
300300
set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH};/usr/local/")
301301
find_package(Boost REQUIRED)
302-
else()
302+
elseif(NOT WIN32)
303303
set(Boost_USE_STATIC_LIBS ON)
304304
find_package(Boost REQUIRED COMPONENTS system)
305305
endif()
306306

307-
if(NOT Boost_FOUND)
308-
message(FATAL_ERROR "${Red}Boost could not be located${ColorReset}")
309-
else()
310-
psp_build_message("${Cyan}Found Boost: `Boost_INCLUDE_DIRS`: ${Boost_INCLUDE_DIRS}, `Boost_LIBRARY_DIRS` - ${Boost_LIBRARY_DIRS} ${ColorReset}")
311-
312-
if(WIN32)
313-
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
314-
add_definitions(-DBOOST_UUID_FORCE_AUTO_LINK)
315-
endif()
316-
endif()
317-
318307
if(WIN32)
319308
foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
320309
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
@@ -329,21 +318,8 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
329318
endif()
330319

331320
if(PSP_PYTHON_BUILD)
332-
# ########################
333-
# PYTHON BINDINGS BUILD #
334-
# ########################
335321
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
336322
include_directories("${PSP_PYTHON_SRC}/perspective/include")
337-
338-
if(MANYLINUX)
339-
# Manylinux docker images have no shared libraries
340-
# The instead use a statically built python.
341-
# Cmake's default FindPython can't find the python headers
342-
# without also finding (or failing to find) the python libraries
343-
# so we use a custom FindPythonHeaders that is the same as the
344-
# default, but ignores when the python libraries can't be found.
345-
psp_build_message("${Red}Manylinux build has no python shared libraries${ColorReset}")
346-
endif()
347323
endif()
348324
endif()
349325

@@ -353,10 +329,18 @@ set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Disable rapidjson tests")
353329
set(CMAKE_C_FLAGS " \
354330
-O3 \
355331
")
332+
if (PSP_WASM_EXCEPTIONS)
333+
set(CMAKE_CXX_FLAGS " -fwasm-exceptions \
334+
-O3 \
335+
-g0 \
336+
")
337+
else()
356338
set(CMAKE_CXX_FLAGS " \
357339
-O3 \
358340
")
359341

342+
endif()
343+
360344
if(PSP_PYODIDE)
361345
set(RELOCATABLE_FLAGS "-sRELOCATABLE=1 -sSIDE_MODULE=2 -sWASM_BIGINT=1")
362346

@@ -399,6 +383,24 @@ psp_build_dep("lz4" "${PSP_CMAKE_MODULE_PATH}/lz4.txt.in")
399383
# Build minimal arrow itself
400384
psp_build_dep("arrow" "${PSP_CMAKE_MODULE_PATH}/arrow.txt.in")
401385

386+
if(PSP_PYTHON_BUILD AND NOT PSP_PYODIDE)
387+
# Boost must be added after arrow to prevent linking bug on Windows.
388+
if(WIN32)
389+
set(Boost_USE_STATIC_LIBS ON)
390+
find_package(Boost REQUIRED COMPONENTS system)
391+
endif()
392+
if(NOT Boost_FOUND)
393+
message(FATAL_ERROR "${Red}Boost could not be located${ColorReset}")
394+
else()
395+
psp_build_message("${Cyan}Found Boost: `Boost_INCLUDE_DIRS`: ${Boost_INCLUDE_DIRS}, `Boost_LIBRARY_DIRS` - ${Boost_LIBRARY_DIRS} ${ColorReset}")
396+
if(WIN32)
397+
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
398+
add_definitions(-DBOOST_UUID_FORCE_AUTO_LINK)
399+
endif()
400+
endif()
401+
endif()
402+
403+
402404
# Build re2 as our regex library
403405
# this is a workaround for some re2-specific weirdness
404406
add_definitions(-DTARGET_OS_OSX=1)
@@ -587,7 +589,7 @@ if(PSP_WASM_BUILD AND NOT PSP_PYTHON_BUILD)
587589
add_library(psp ${WASM_SOURCE_FILES})
588590
target_compile_definitions(psp PRIVATE PSP_ENABLE_WASM=1)
589591
set_target_properties(psp PROPERTIES COMPILE_FLAGS "")
590-
target_link_libraries(psp PRIVATE arrow re2 protos)
592+
target_link_libraries(psp PRIVATE arrow_static re2 protos)
591593

592594
add_executable(perspective_esm src/cpp/binding_api.cpp)
593595
target_link_libraries(perspective_esm psp protos)
@@ -628,7 +630,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
628630
target_compile_definitions(psp PRIVATE PSP_ENABLE_PYTHON=1 PSP_ENABLE_WASM=1)
629631
# support for emscripten exceptions https://emscripten.org/docs/porting/exceptions.html#emscripten-javascript-based-exception-support
630632
target_compile_options(psp PUBLIC -fexceptions -fvisibility=hidden)
631-
target_compile_options(arrow PUBLIC -fexceptions -fvisibility=hidden)
633+
target_compile_options(arrow_static PUBLIC -fexceptions -fvisibility=hidden)
632634
target_compile_options(re2 PUBLIC -fexceptions -fvisibility=hidden)
633635
target_compile_options(protos PUBLIC -fexceptions -fvisibility=hidden)
634636
else()
@@ -647,25 +649,14 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
647649
# intentionally blank
648650
else()
649651
target_compile_options(psp PRIVATE -fvisibility=hidden)
650-
# target_compile_options(psppy PRIVATE -Wdeprecated-declarations)
651652
endif()
652653

653654
# Link against minimal arrow static library
654-
target_link_libraries(psp PRIVATE arrow re2 protos)
655-
# target_link_libraries(psppy psp)
656-
657-
# The compiled libraries will be put in CMAKE_LIBRARY_OUTPUT_DIRECTORY by default. In the
658-
# setup.py file, we designate this to be in the build/lib.<platform> directory. However,
659-
# since we want to be able to test perspective in-source, we also copy the libraries into
660-
# the source folder. These two commands do that.
661-
# add_custom_command(TARGET psp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:psp> ${PSP_PYTHON_SRC}/table/)
662-
# add_custom_command(TARGET psppy POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:psppy> ${PSP_PYTHON_SRC}/table/)
663-
664-
# #######################
655+
target_link_libraries(psp PRIVATE arrow_static re2 protos lz4_static libzstd_static)
665656
else()
666657
add_library(psp STATIC ${WASM_SOURCE_FILES})
667658
target_compile_options(psp PRIVATE -fvisibility=hidden)
668-
target_link_libraries(psp PRIVATE arrow re2 protos)
659+
target_link_libraries(psp PRIVATE arrow_static re2 protos)
669660
endif()
670661

671662
if(PSP_CPP_BUILD_STRICT AND NOT WIN32)

cpp/perspective/src/cpp/arrow_csv.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
#include <perspective/arrow_csv.h>
1616
#include <arrow/util/value_parsing.h>
1717
#include <arrow/io/memory.h>
18-
19-
#ifdef PSP_ENABLE_WASM
20-
// This causes build warnings
21-
// https://github.com/emscripten-core/emscripten/issues/8574
22-
#include <perspective/vendor/arrow_single_threaded_reader.h>
23-
#else
2418
#include <arrow/csv/reader.h>
25-
#endif
2619

2720
template <class TimePoint>
2821
static inline arrow::TimestampType::c_type

cpp/perspective/src/cpp/table.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "perspective/data_table.h"
1717
#include "perspective/raw_types.h"
1818
#include "perspective/schema.h"
19-
// #include "arrow/vendored/datetime/date.h"
2019
#include "rapidjson/document.h"
2120
#include <chrono>
2221
#include <ctime>
@@ -448,18 +447,6 @@ rapidjson_type_to_dtype(const rapidjson::Value& value) {
448447
std::chrono::system_clock::time_point tp;
449448

450449
if (parse_all_date_time(tm, tp, str)) {
451-
LOG_DEBUG(
452-
"Parsed date: " << tm.tm_year + 1900 << "-" << tm.tm_mon + 1
453-
<< "-" << tm.tm_mday << " " << tm.tm_hour
454-
<< ":" << tm.tm_min << ":" << tm.tm_sec
455-
);
456-
auto tpm =
457-
std::chrono::duration_cast<std::chrono::milliseconds>(
458-
tp.time_since_epoch()
459-
)
460-
.count();
461-
LOG_DEBUG("TP: " << tpm << '\n');
462-
463450
if (tm.tm_hour == 0 && tm.tm_min == 0 && tm.tm_sec == 0) {
464451
return t_dtype::DTYPE_DATE;
465452
}

0 commit comments

Comments
 (0)