Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ addons:
- g++-4.9
- valgrind
- libboost-dev
- libboost-filesystem-dev
- libboost-system-dev
- libboost-program-options-dev
- libboost-test-dev
- libssl-dev
Expand All @@ -26,7 +28,7 @@ matrix:
before_script:
- source $TRAVIS_BUILD_DIR/ci/before_script_travis.sh
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DPARQUET_TEST_MEMCHECK=ON -DPARQUET_BUILD_BENCHMARKS=ON
-DPARQUET_GENERATE_COVERAGE=1 $TRAVIS_BUILD_DIR
-DPARQUET_ARROW=ON -DPARQUET_GENERATE_COVERAGE=1 $TRAVIS_BUILD_DIR
- export PARQUET_TEST_DATA=$TRAVIS_BUILD_DIR/data
- compiler: clang
os: linux
Expand Down Expand Up @@ -76,7 +78,7 @@ before_install:

before_script:
- source $TRAVIS_BUILD_DIR/ci/before_script_travis.sh
- cmake -DCMAKE_CXX_FLAGS="-Werror" $TRAVIS_BUILD_DIR
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DPARQUET_ARROW=ON $TRAVIS_BUILD_DIR
- export PARQUET_TEST_DATA=$TRAVIS_BUILD_DIR/data

script:
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
option(PARQUET_BUILD_EXECUTABLES
"Build the libparquet executable CLI tools"
ON)
option(PARQUET_ARROW
"Build the Arrow support"
OFF)
endif()

# If build in-source, create the latest symlink. If build out-of-source, which is
Expand Down Expand Up @@ -247,6 +250,16 @@ function(ADD_PARQUET_TEST_DEPENDENCIES REL_TEST_NAME)
add_dependencies(${TEST_NAME} ${ARGN})
endfunction()

# A wrapper for add_dependencies() that is compatible with PARQUET_BUILD_TESTS.
function(ADD_PARQUET_LINK_LIBRARIES REL_TEST_NAME)
if(NOT PARQUET_BUILD_TESTS)
return()
endif()
get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE)

target_link_libraries(${TEST_NAME} ${ARGN})
endfunction()

enable_testing()

############################################################
Expand Down Expand Up @@ -553,6 +566,12 @@ if (PARQUET_BUILD_SHARED)
target_link_libraries(parquet_shared
LINK_PUBLIC ${LIBPARQUET_LINK_LIBS}
LINK_PRIVATE ${LIBPARQUET_PRIVATE_LINK_LIBS})
if (APPLE)
set_target_properties(parquet_shared
PROPERTIES
BUILD_WITH_INSTALL_RPATH ON
INSTALL_NAME_DIR "@rpath")
endif()
endif()

if (PARQUET_BUILD_STATIC)
Expand Down Expand Up @@ -583,6 +602,22 @@ add_dependencies(parquet_objlib parquet_thrift)
add_subdirectory(benchmarks)
add_subdirectory(tools)

# Arrow
if (PARQUET_ARROW)
find_package(Arrow REQUIRED)
include_directories(SYSTEM ${ARROW_INCLUDE_DIR})
add_library(arrow SHARED IMPORTED)
set_target_properties(arrow PROPERTIES IMPORTED_LOCATION ${ARROW_SHARED_LIB})
add_library(arrow_io SHARED IMPORTED)
set_target_properties(arrow_io PROPERTIES IMPORTED_LOCATION ${ARROW_IO_SHARED_LIB})
add_library(arrow_static STATIC IMPORTED)
set_target_properties(arrow_static PROPERTIES IMPORTED_LOCATION ${ARROW_STATIC_LIB})
add_library(arrow_io_static STATIC IMPORTED)
set_target_properties(arrow_io_static PROPERTIES IMPORTED_LOCATION ${ARROW_IO_STATIC_LIB})

add_subdirectory(src/parquet/arrow)
endif()

add_custom_target(clean-all
COMMAND ${CMAKE_BUILD_TOOL} clean
COMMAND ${CMAKE_COMMAND} -P cmake_modules/clean-all.cmake
Expand Down
4 changes: 2 additions & 2 deletions ci/travis_script_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ make lint

if [ $TRAVIS_OS_NAME == "linux" ]; then
make -j4 || exit 1
ctest -L unittest || { cat $TRAVIS_BUILD_DIR/parquet-build/Testing/Temporary/LastTest.log; exit 1; }
ctest -VV -L unittest || { cat $TRAVIS_BUILD_DIR/parquet-build/Testing/Temporary/LastTest.log; exit 1; }
sudo pip install cpp_coveralls
export PARQUET_ROOT=$TRAVIS_BUILD_DIR
$TRAVIS_BUILD_DIR/ci/upload_coverage.sh
else
make -j4 || exit 1
ctest -L unittest || { cat $TRAVIS_BUILD_DIR/parquet-build/Testing/Temporary/LastTest.log; exit 1; }
ctest -VV -L unittest || { cat $TRAVIS_BUILD_DIR/parquet-build/Testing/Temporary/LastTest.log; exit 1; }
fi

popd
87 changes: 87 additions & 0 deletions cmake_modules/FindArrow.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# - Find ARROW (arrow/api.h, libarrow.a, libarrow.so)
# This module defines
# ARROW_INCLUDE_DIR, directory containing headers
# ARROW_LIBS, directory containing arrow libraries
# ARROW_STATIC_LIB, path to libarrow.a
# ARROW_SHARED_LIB, path to libarrow's shared library
# ARROW_FOUND, whether arrow has been found

set(ARROW_SEARCH_HEADER_PATHS
$ENV{ARROW_HOME}/include
)

set(ARROW_SEARCH_LIB_PATH
$ENV{ARROW_HOME}/lib
)

find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS
${ARROW_SEARCH_HEADER_PATHS}
# make sure we don't accidentally pick up a different version
NO_DEFAULT_PATH
)

find_library(ARROW_LIB_PATH NAMES arrow
PATHS
${ARROW_SEARCH_LIB_PATH}
NO_DEFAULT_PATH)

find_library(ARROW_IO_LIB_PATH NAMES arrow_io
PATHS
${ARROW_SEARCH_LIB_PATH}
NO_DEFAULT_PATH)

if (ARROW_INCLUDE_DIR AND ARROW_LIB_PATH)
set(ARROW_FOUND TRUE)
set(ARROW_LIB_NAME libarrow)
set(ARROW_IO_LIB_NAME libarrow_io)

set(ARROW_LIBS ${ARROW_SEARCH_LIB_PATH})
set(ARROW_STATIC_LIB ${ARROW_SEARCH_LIB_PATH}/${ARROW_LIB_NAME}.a)
set(ARROW_SHARED_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})

set(ARROW_IO_STATIC_LIB ${ARROW_SEARCH_LIB_PATH}/${ARROW_IO_LIB_NAME}.a)
set(ARROW_IO_SHARED_LIB ${ARROW_LIBS}/${ARROW_IO_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
if (NOT Arrow_FIND_QUIETLY)
message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}")
message(STATUS "Found the Arrow IO library: ${ARROW_IO_LIB_PATH}")
endif ()
else ()
if (NOT Arrow_FIND_QUIETLY)
set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers")
set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs")
set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_LIB_PATH}")
if (Arrow_FIND_REQUIRED)
message(FATAL_ERROR "${ARROW_ERR_MSG}")
else (Arrow_FIND_REQUIRED)
message(STATUS "${ARROW_ERR_MSG}")
endif (Arrow_FIND_REQUIRED)
endif ()
set(ARROW_FOUND FALSE)
endif ()

mark_as_advanced(
ARROW_FOUND
ARROW_INCLUDE_DIR
ARROW_LIBS
ARROW_STATIC_LIB
ARROW_SHARED_LIB
ARROW_IO_STATIC_LIB
ARROW_IO_SHARED_LIB
)
1 change: 1 addition & 0 deletions conda.recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ cmake \
-DCMAKE_BUILD_TYPE=debug \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DPARQUET_BUILD_BENCHMARKS=off \
-DPARQUET_ARROW=ON \
..

make
Expand Down
90 changes: 90 additions & 0 deletions src/parquet/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# ----------------------------------------------------------------------
# parquet_arrow : Arrow <-> Parquet adapter

set(PARQUET_ARROW_SRCS
io.cc
reader.cc
schema.cc
writer.cc
)

add_library(parquet_arrow_objlib OBJECT
${PARQUET_ARROW_SRCS}
)

# SET_TARGET_PROPERTIES(parquet_arrow PROPERTIES LINKER_LANGUAGE CXX)

if (PARQUET_BUILD_SHARED)
add_library(parquet_arrow_shared SHARED $<TARGET_OBJECTS:parquet_arrow_objlib>)
set_target_properties(parquet_arrow_shared
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}"
LINK_FLAGS "${SHARED_LINK_FLAGS}"
OUTPUT_NAME "parquet_arrow")
target_link_libraries(parquet_arrow_shared
arrow
arrow_io
parquet_shared)
if (APPLE)
set_target_properties(parquet_arrow_shared
PROPERTIES
BUILD_WITH_INSTALL_RPATH ON
INSTALL_NAME_DIR "@rpath")
endif()
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: building static libparquet_arrow.a


if (PARQUET_BUILD_STATIC)
add_library(parquet_arrow_static STATIC $<TARGET_OBJECTS:parquet_arrow_objlib>)
set_target_properties(parquet_arrow_static
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}"
OUTPUT_NAME "parquet_arrow")
target_link_libraries(parquet_arrow_static
arrow_static
arrow_static
parquet_static)
install(TARGETS parquet_arrow_static
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
endif()

ADD_PARQUET_TEST(arrow-schema-test)
ADD_PARQUET_TEST(arrow-io-test)
ADD_PARQUET_TEST(arrow-reader-writer-test)

if (PARQUET_BUILD_STATIC)
ADD_PARQUET_LINK_LIBRARIES(arrow-schema-test parquet_arrow_static)
ADD_PARQUET_LINK_LIBRARIES(arrow-io-test parquet_arrow_static)
ADD_PARQUET_LINK_LIBRARIES(arrow-reader-writer-test parquet_arrow_static)
else()
ADD_PARQUET_LINK_LIBRARIES(arrow-schema-test parquet_arrow_shared)
ADD_PARQUET_LINK_LIBRARIES(arrow-io-test parquet_arrow_shared)
ADD_PARQUET_LINK_LIBRARIES(arrow-reader-writer-test parquet_arrow_shared)
endif()

# Headers: top level
install(FILES
io.h
reader.h
schema.h
utils.h
writer.h
DESTINATION include/parquet/arrow)

Loading