From 53366ef26853a5700a2c1808886ba7d44f3fbea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 22 Aug 2023 17:32:29 +0200 Subject: [PATCH 1/5] GH-37308: [C++][Doc] Change name for CPP tutorial and minor fixes to the job --- cpp/examples/tutorial_examples/CMakeLists.txt | 2 ++ cpp/examples/tutorial_examples/dataset_example.cc | 1 + cpp/examples/tutorial_examples/run.sh | 2 ++ dev/tasks/tasks.yml | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/examples/tutorial_examples/CMakeLists.txt b/cpp/examples/tutorial_examples/CMakeLists.txt index 7758af90fb2a2..41e9fc0428d93 100644 --- a/cpp/examples/tutorial_examples/CMakeLists.txt +++ b/cpp/examples/tutorial_examples/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(Arrow REQUIRED) get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY) find_package(Parquet REQUIRED HINTS ${ARROW_CONFIG_PATH}) +find_package(ArrowAcero REQUIRED HINTS ${ARROW_CONFIG_PATH}) find_package(ArrowDataset REQUIRED HINTS ${ARROW_CONFIG_PATH}) set(CMAKE_CXX_STANDARD 17) @@ -45,4 +46,5 @@ target_link_libraries(compute_example PRIVATE Arrow::arrow_shared) add_executable(dataset_example dataset_example.cc) target_link_libraries(dataset_example PRIVATE Arrow::arrow_shared Parquet::parquet_shared + ArrowAcero::arrow_acero_shared ArrowDataset::arrow_dataset_shared) diff --git a/cpp/examples/tutorial_examples/dataset_example.cc b/cpp/examples/tutorial_examples/dataset_example.cc index 005cdc324d057..6993658f755a8 100644 --- a/cpp/examples/tutorial_examples/dataset_example.cc +++ b/cpp/examples/tutorial_examples/dataset_example.cc @@ -26,6 +26,7 @@ #include #include +#include // (Doc section: Includes) // (Doc section: Helper Functions) diff --git a/cpp/examples/tutorial_examples/run.sh b/cpp/examples/tutorial_examples/run.sh index ed319a9d327ec..53932e5a03825 100755 --- a/cpp/examples/tutorial_examples/run.sh +++ b/cpp/examples/tutorial_examples/run.sh @@ -45,6 +45,8 @@ echo "== Running example project" echo "==" echo +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + ${EXAMPLE_BUILD_DIR}/arrow_example ${EXAMPLE_BUILD_DIR}/compute_example ${EXAMPLE_BUILD_DIR}/file_access_example diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index bad5b3c1f8988..2e5ccbba56f77 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -1625,7 +1625,7 @@ tasks: run: {{ kind }} {% endfor %} - cpp-tutorial-example: + example-cpp-tutorial: ci: github template: cpp-examples/github.linux.yml params: From 6d76b2dc912fa5b45700a958d41111550f531317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 22 Aug 2023 17:55:40 +0200 Subject: [PATCH 2/5] Fix lint --- cpp/examples/tutorial_examples/CMakeLists.txt | 7 ++++--- cpp/examples/tutorial_examples/dataset_example.cc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/examples/tutorial_examples/CMakeLists.txt b/cpp/examples/tutorial_examples/CMakeLists.txt index 41e9fc0428d93..1ed7f8664df14 100644 --- a/cpp/examples/tutorial_examples/CMakeLists.txt +++ b/cpp/examples/tutorial_examples/CMakeLists.txt @@ -45,6 +45,7 @@ add_executable(compute_example compute_example.cc) target_link_libraries(compute_example PRIVATE Arrow::arrow_shared) add_executable(dataset_example dataset_example.cc) -target_link_libraries(dataset_example PRIVATE Arrow::arrow_shared Parquet::parquet_shared - ArrowAcero::arrow_acero_shared - ArrowDataset::arrow_dataset_shared) +target_link_libraries(dataset_example + PRIVATE Arrow::arrow_shared Parquet::parquet_shared + ArrowAcero::arrow_acero_shared + ArrowDataset::arrow_dataset_shared) diff --git a/cpp/examples/tutorial_examples/dataset_example.cc b/cpp/examples/tutorial_examples/dataset_example.cc index 6993658f755a8..a980fa54939c5 100644 --- a/cpp/examples/tutorial_examples/dataset_example.cc +++ b/cpp/examples/tutorial_examples/dataset_example.cc @@ -25,8 +25,8 @@ #include #include -#include #include +#include // (Doc section: Includes) // (Doc section: Helper Functions) From 99621cae5c341727ce7a13c7002c7bd498e157c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 23 Aug 2023 10:57:16 +0200 Subject: [PATCH 3/5] Remove unnecessary find_packages and add ARROW_INSTALL_DIR options --- cpp/examples/tutorial_examples/CMakeLists.txt | 9 ++------- cpp/examples/tutorial_examples/build_example.sh | 2 +- cpp/examples/tutorial_examples/run.sh | 9 +++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cpp/examples/tutorial_examples/CMakeLists.txt b/cpp/examples/tutorial_examples/CMakeLists.txt index 1ed7f8664df14..b5932ef6bd323 100644 --- a/cpp/examples/tutorial_examples/CMakeLists.txt +++ b/cpp/examples/tutorial_examples/CMakeLists.txt @@ -22,9 +22,7 @@ project(ArrowTutorialExamples) find_package(Arrow REQUIRED) get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY) -find_package(Parquet REQUIRED HINTS ${ARROW_CONFIG_PATH}) -find_package(ArrowAcero REQUIRED HINTS ${ARROW_CONFIG_PATH}) -find_package(ArrowDataset REQUIRED HINTS ${ARROW_CONFIG_PATH}) +find_package(ArrowDataset) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra") @@ -45,7 +43,4 @@ add_executable(compute_example compute_example.cc) target_link_libraries(compute_example PRIVATE Arrow::arrow_shared) add_executable(dataset_example dataset_example.cc) -target_link_libraries(dataset_example - PRIVATE Arrow::arrow_shared Parquet::parquet_shared - ArrowAcero::arrow_acero_shared - ArrowDataset::arrow_dataset_shared) +target_link_libraries(dataset_example PRIVATE ArrowDataset::arrow_dataset_shared) diff --git a/cpp/examples/tutorial_examples/build_example.sh b/cpp/examples/tutorial_examples/build_example.sh index a315755a597f5..0b279890a78e4 100755 --- a/cpp/examples/tutorial_examples/build_example.sh +++ b/cpp/examples/tutorial_examples/build_example.sh @@ -21,7 +21,7 @@ set -ex mkdir -p $EXAMPLE_BUILD_DIR pushd $EXAMPLE_BUILD_DIR -cmake /io +cmake /io $EXAMPLE_CMAKE_OPTIONS make popd diff --git a/cpp/examples/tutorial_examples/run.sh b/cpp/examples/tutorial_examples/run.sh index 53932e5a03825..4e5e8eeabd891 100755 --- a/cpp/examples/tutorial_examples/run.sh +++ b/cpp/examples/tutorial_examples/run.sh @@ -22,6 +22,7 @@ cd /io export ARROW_BUILD_DIR=/build/arrow export EXAMPLE_BUILD_DIR=/build/example +export ARROW_INSTALL_DIR=/build/arrow-install echo echo "==" @@ -29,7 +30,8 @@ echo "== Building Arrow C++ library" echo "==" echo -./build_arrow.sh +ARROW_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${ARROW_INSTALL_DIR}" \ + ./build_arrow.sh echo echo "==" @@ -37,7 +39,8 @@ echo "== Building example project using Arrow C++ library" echo "==" echo -./build_example.sh +EXAMPLE_CMAKE_OPTIONS="-DCMAKE_INSTALL_RPATH=${ARROW_INSTALL_DIR}/lib -DCMAKE_PREFIX_PATH=${ARROW_INSTALL_DIR}" \ + ./build_example.sh echo echo "==" @@ -45,8 +48,6 @@ echo "== Running example project" echo "==" echo -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib - ${EXAMPLE_BUILD_DIR}/arrow_example ${EXAMPLE_BUILD_DIR}/compute_example ${EXAMPLE_BUILD_DIR}/file_access_example From 62d9e7f31a69d83f439d32bb5ce3242f3e83e3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 24 Aug 2023 14:23:45 +0200 Subject: [PATCH 4/5] Update cpp/examples/tutorial_examples/CMakeLists.txt Co-authored-by: Sutou Kouhei --- cpp/examples/tutorial_examples/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/cpp/examples/tutorial_examples/CMakeLists.txt b/cpp/examples/tutorial_examples/CMakeLists.txt index b5932ef6bd323..8788501484c87 100644 --- a/cpp/examples/tutorial_examples/CMakeLists.txt +++ b/cpp/examples/tutorial_examples/CMakeLists.txt @@ -19,9 +19,6 @@ cmake_minimum_required(VERSION 3.16) project(ArrowTutorialExamples) -find_package(Arrow REQUIRED) - -get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY) find_package(ArrowDataset) set(CMAKE_CXX_STANDARD 17) From bd1320dfb9c44415bfe2170698a34c64e54d5664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 24 Aug 2023 14:34:05 +0200 Subject: [PATCH 5/5] Add Arrow install to rpath --- cpp/examples/tutorial_examples/run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/examples/tutorial_examples/run.sh b/cpp/examples/tutorial_examples/run.sh index 4e5e8eeabd891..bc0078435cc47 100755 --- a/cpp/examples/tutorial_examples/run.sh +++ b/cpp/examples/tutorial_examples/run.sh @@ -30,7 +30,8 @@ echo "== Building Arrow C++ library" echo "==" echo -ARROW_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${ARROW_INSTALL_DIR}" \ +ARROW_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${ARROW_INSTALL_DIR} \ + -DCMAKE_INSTALL_RPATH=${ARROW_INSTALL_DIR}/lib" \ ./build_arrow.sh echo @@ -39,7 +40,8 @@ echo "== Building example project using Arrow C++ library" echo "==" echo -EXAMPLE_CMAKE_OPTIONS="-DCMAKE_INSTALL_RPATH=${ARROW_INSTALL_DIR}/lib -DCMAKE_PREFIX_PATH=${ARROW_INSTALL_DIR}" \ +EXAMPLE_CMAKE_OPTIONS="-DCMAKE_INSTALL_RPATH=${ARROW_INSTALL_DIR}/lib \ + -DCMAKE_PREFIX_PATH=${ARROW_INSTALL_DIR}" \ ./build_example.sh echo