From commits-return-1243-archive-asf-public=cust-asf.ponee.io@parquet.apache.org Wed Feb 21 19:15:16 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2B7E518061A for ; Wed, 21 Feb 2018 19:15:16 +0100 (CET) Received: (qmail 77612 invoked by uid 500); 21 Feb 2018 18:15:15 -0000 Mailing-List: contact commits-help@parquet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@parquet.apache.org Delivered-To: mailing list commits@parquet.apache.org Received: (qmail 77603 invoked by uid 99); 21 Feb 2018 18:15:15 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Feb 2018 18:15:15 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 462C684AA2; Wed, 21 Feb 2018 18:15:14 +0000 (UTC) Date: Wed, 21 Feb 2018 18:15:14 +0000 To: "commits@parquet.apache.org" Subject: =?utf-8?q?=5Bparquet-cpp=5D_branch_master_updated=3A_PARQUET-123?= =?utf-8?q?3=3A_Enable_option_to_switch_between_stl_classes_and_boost_c?= =?utf-8?b?4oCm?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <151923691414.28863.2515147429697954118@gitbox.apache.org> From: wesm@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: parquet-cpp X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 741012f64ee668d63583ba883d78158f3b8a5101 X-Git-Newrev: e7db0654f895fbe0ba45ca925ef4380f48c93b2d X-Git-Rev: e7db0654f895fbe0ba45ca925ef4380f48c93b2d X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. wesm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/parquet-cpp.git The following commit(s) were added to refs/heads/master by this push: new e7db065 PARQUET-1233: Enable option to switch between stl classes and boost c… e7db065 is described below commit e7db0654f895fbe0ba45ca925ef4380f48c93b2d Author: Deepak Majeti AuthorDate: Wed Feb 21 13:15:09 2018 -0500 PARQUET-1233: Enable option to switch between stl classes and boost c… …lasses for thrift header Author: Deepak Majeti Author: Wes McKinney Closes #443 from majetideepak/PARQUET-1233 and squashes the following commits: 8d56f96 [Wes McKinney] Add PARQUET_THRIFT_USE_BOOST CMake option 37318dd [Deepak Majeti] Pin Thrift version 0.10.0 to toolchain d065f80 [Deepak Majeti] PARQUET-1233: Enable option to switch between stl classes and boost classes for thrift header --- CMakeLists.txt | 5 +++++ ci/travis_script_static.sh | 3 ++- ci/travis_script_toolchain.sh | 2 +- cmake_modules/ThirdpartyToolchain.cmake | 10 ++++++++-- src/parquet/thrift.h | 22 ++++++++++++++++++---- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bca8478..304f3fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,11 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") option(PARQUET_MINIMAL_DEPENDENCY "Depend only on Thirdparty headers to build libparquet. Always OFF if building binaries" OFF) + + option(PARQUET_THRIFT_USE_BOOST + "Enable if Thirdparty Thrift uses boost::shared_ptr (Apache Thrift < 0.11)" + OFF) + if (MSVC) set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING "Arrow static lib suffix used on Windows with MSVC (default _static)") diff --git a/ci/travis_script_static.sh b/ci/travis_script_static.sh index 6da7a33..b76ced8 100755 --- a/ci/travis_script_static.sh +++ b/ci/travis_script_static.sh @@ -40,7 +40,7 @@ conda config --set remote_connect_timeout_secs 12 conda info -a conda create -y -q -p $CPP_TOOLCHAIN \ - boost-cpp thrift-cpp cmake git \ + boost-cpp thrift-cpp=0.10.0 cmake git \ -c conda-forge source activate $CPP_TOOLCHAIN @@ -70,6 +70,7 @@ cmake -DPARQUET_CXXFLAGS="$PARQUET_CXXFLAGS" \ -DPARQUET_ARROW_LINKAGE="static" \ -DPARQUET_BUILD_SHARED=OFF \ -DPARQUET_BOOST_USE_SHARED=OFF \ + -DPARQUET_THRIFT_USE_BOOST=ON \ -DPARQUET_BUILD_BENCHMARKS=ON \ -DPARQUET_BUILD_EXAMPLES=ON \ -DPARQUET_GENERATE_COVERAGE=1 \ diff --git a/ci/travis_script_toolchain.sh b/ci/travis_script_toolchain.sh index 7db9658..036ab3c 100755 --- a/ci/travis_script_toolchain.sh +++ b/ci/travis_script_toolchain.sh @@ -40,7 +40,7 @@ conda config --set remote_connect_timeout_secs 12 conda info -a conda create -y -q -p $CPP_TOOLCHAIN \ - boost-cpp thrift-cpp cmake git \ + boost-cpp thrift-cpp=0.11.0 cmake git \ -c conda-forge # ---------------------------------------------------------------------- diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index 3c197dd..690fd0b 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake @@ -17,7 +17,7 @@ set(GTEST_VERSION "1.8.0") set(GBENCHMARK_VERSION "1.1.0") -set(THRIFT_VERSION "0.11.0") +set(THRIFT_VENDOR_VERSION "0.11.0") string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE) @@ -244,7 +244,7 @@ if (NOT THRIFT_FOUND) endif() ExternalProject_Add(thrift_ep - URL "http://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz" + URL "http://archive.apache.org/dist/thrift/${THRIFT_VENDOR_VERSION}/thrift-${THRIFT_VENDOR_VERSION}.tar.gz" BUILD_BYPRODUCTS "${THRIFT_STATIC_LIB}" "${THRIFT_COMPILER}" CMAKE_ARGS ${THRIFT_CMAKE_ARGS} DEPENDS ${THRIFT_DEPENDENCIES} @@ -259,6 +259,7 @@ include_directories(SYSTEM ${THRIFT_INCLUDE_DIR} ${THRIFT_INCLUDE_DIR}/thrift) message(STATUS "Thrift include dir: ${THRIFT_INCLUDE_DIR}") message(STATUS "Thrift static library: ${THRIFT_STATIC_LIB}") message(STATUS "Thrift compiler: ${THRIFT_COMPILER}") +message(STATUS "Thrift version: ${THRIFT_VERSION}") add_library(thriftstatic STATIC IMPORTED) set_target_properties(thriftstatic PROPERTIES IMPORTED_LOCATION ${THRIFT_STATIC_LIB}) @@ -266,6 +267,11 @@ if (THRIFT_VENDORED) add_dependencies(thriftstatic thrift_ep) endif() +if (PARQUET_THRIFT_USE_BOOST) + add_definitions(-DPARQUET_THRIFT_USE_BOOST) + message(STATUS "Using Boost in Thrift header") +endif() + ## GTest if(PARQUET_BUILD_TESTS AND NOT IGNORE_OPTIONAL_PACKAGES) add_custom_target(unittest ctest -L unittest) diff --git a/src/parquet/thrift.h b/src/parquet/thrift.h index d2915a9..ec7ac90 100644 --- a/src/parquet/thrift.h +++ b/src/parquet/thrift.h @@ -19,7 +19,13 @@ #define PARQUET_THRIFT_UTIL_H #include +// Check if thrift version < 0.11.0 +// or if FORCE_BOOST_SMART_PTR is defined. Ref: https://thrift.apache.org/lib/cpp +#if defined(PARQUET_THRIFT_USE_BOOST) || defined(FORCE_BOOST_SMART_PTR) +#include +#else #include +#endif // TCompactProtocol requires some #defines to work right. #define SIGNED_RIGHT_SHIFT_IS 1 @@ -39,6 +45,14 @@ namespace parquet { +// Check if thrift version < 0.11.0 +// or if FORCE_BOOST_SMART_PTR is defined. Ref: https://thrift.apache.org/lib/cpp +#if defined(PARQUET_THRIFT_USE_BOOST) || defined(FORCE_BOOST_SMART_PTR) +using ::boost::shared_ptr; +#else +using ::std::shared_ptr; +#endif + // ---------------------------------------------------------------------- // Convert Thrift enums to / from parquet enums @@ -94,12 +108,12 @@ static inline format::CompressionCodec::type ToThrift(Compression::type type) { template inline void DeserializeThriftMsg(const uint8_t* buf, uint32_t* len, T* deserialized_msg) { // Deserialize msg bytes into c++ thrift msg using memory transport. - std::shared_ptr tmem_transport( + shared_ptr tmem_transport( new apache::thrift::transport::TMemoryBuffer(const_cast(buf), *len)); apache::thrift::protocol::TCompactProtocolFactoryT< apache::thrift::transport::TMemoryBuffer> tproto_factory; - std::shared_ptr tproto = + shared_ptr tproto = tproto_factory.getProtocol(tmem_transport); try { deserialized_msg->read(tproto.get()); @@ -117,12 +131,12 @@ inline void DeserializeThriftMsg(const uint8_t* buf, uint32_t* len, T* deseriali // the expected size of the serialized object template inline int64_t SerializeThriftMsg(T* obj, uint32_t len, OutputStream* out) { - std::shared_ptr mem_buffer( + shared_ptr mem_buffer( new apache::thrift::transport::TMemoryBuffer(len)); apache::thrift::protocol::TCompactProtocolFactoryT< apache::thrift::transport::TMemoryBuffer> tproto_factory; - std::shared_ptr tproto = + shared_ptr tproto = tproto_factory.getProtocol(mem_buffer); try { mem_buffer->resetBuffer(); -- To stop receiving notification emails like this one, please contact wesm@apache.org.