From 5c2bb6f714f65393af3479eda6c602de8060a276 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Mon, 2 Dec 2019 10:00:37 +0900 Subject: [PATCH] PARQUET-1692: [C++] LogicalType::FromThrift error on Centos 7 RPM See details here: https://issues.apache.org/jira/browse/PARQUET-1692 Closes #5900 from orozery/require-thrift-10 and squashes the following commits: 1d9b1eab3 fix 9cb961cd1 post-review ee3ff09f3 remove thrift dependency from RPMs b8df2db4a require thrift version 0.10.0 Authored-by: Or Ozeri Signed-off-by: Sutou Kouhei --- cpp/cmake_modules/FindThrift.cmake | 13 ++++++++++--- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 ++- .../linux-packages/apache-arrow/yum/arrow.spec.in | 7 ------- .../apache-arrow/yum/centos-7/Dockerfile | 1 - .../apache-arrow/yum/centos-8/Dockerfile | 1 - 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake index 87cc24eb1c770..f9d6296b4553e 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake @@ -62,6 +62,9 @@ if(Thrift_ROOT) PATHS ${Thrift_ROOT} PATH_SUFFIXES "include") find_program(THRIFT_COMPILER thrift PATHS ${Thrift_ROOT} PATH_SUFFIXES "bin") + if(THRIFT_COMPILER) + extract_thrift_version() + endif() else() # THRIFT-4760: The pkgconfig files are currently only installed when using autotools. # Starting with 0.13, they are also installed for the CMake-based installations of Thrift. @@ -78,11 +81,15 @@ else() HINTS ${THRIFT_PC_PREFIX} NO_DEFAULT_PATH PATH_SUFFIXES "bin") + set(THRIFT_VERSION ${THRIFT_PC_VERSION}) else() find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h PATH_SUFFIXES "include") find_program(THRIFT_COMPILER thrift PATH_SUFFIXES "bin") + if(THRIFT_COMPILER) + extract_thrift_version() + endif() endif() endif() @@ -90,7 +97,9 @@ find_package_handle_standard_args(Thrift REQUIRED_VARS THRIFT_STATIC_LIB THRIFT_INCLUDE_DIR - THRIFT_COMPILER) + THRIFT_COMPILER + VERSION_VAR + THRIFT_VERSION) if(Thrift_FOUND OR THRIFT_FOUND) set(Thrift_FOUND TRUE) @@ -104,6 +113,4 @@ if(Thrift_FOUND OR THRIFT_FOUND) # thrift/windows/config.h for Visual C++. set_target_properties(Thrift::thrift PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32") endif() - - extract_thrift_version() endif() diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 0076fc623539b..7213d83cd68ae 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1095,7 +1095,8 @@ macro(build_thrift) endmacro() if(ARROW_WITH_THRIFT) - resolve_dependency(Thrift) + # Parquet LogicalType requires Thrift union type support, which works well only since 0.10.0 + resolve_dependency_with_version(Thrift 0.10.0) # TODO: Don't use global includes but rather target_include_directories include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index 3188f157ea3e2..fd6ba2a7c40cf 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -44,7 +44,6 @@ %define use_meson (%{_centos_ver} >= 8) %define have_rapidjson (%{_centos_ver} == 7) -%define have_thrift (%{_centos_ver} == 7) Name: @PACKAGE@ Version: @VERSION@ @@ -94,9 +93,6 @@ BuildRequires: ncurses-devel %if %{use_parquet} BuildRequires: bison BuildRequires: flex - %if %{have_thrift} -BuildRequires: thrift-devel - %endif %endif %if %{use_glib} @@ -473,9 +469,6 @@ Libraries and header files for Plasma in-memory object store. Summary: Runtime libraries for Apache Parquet C++ License: Apache-2.0 Requires: boost%{boost_version}-program-options - %if %{have_thrift} -Requires: thrift - %endif Requires: %{name}-libs = %{version}-%{release} %description -n parquet-libs diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile index e3a297aa18586..bfc34819a0b14 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile @@ -51,6 +51,5 @@ RUN \ rpmdevtools \ snappy-devel \ tar \ - thrift-devel \ zlib-devel && \ yum clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-8/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-8/Dockerfile index 3561c0c36c39c..d10cf082798a7 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/centos-8/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-8/Dockerfile @@ -58,6 +58,5 @@ RUN \ rpmdevtools \ snappy-devel \ tar \ - # thrift-devel \ zlib-devel && \ dnf clean ${quiet} all