Skip to content

Commit

Permalink
ARROW-16158: [C++][R] Rename ARROW_ENGINE to ARROW_SUBSTRAIT
Browse files Browse the repository at this point in the history
At the moment there is not enough non-Substrait functionality to justify a dedicated engine module.  In the future there likely will be and so I have some of the general structure around in the C++ (e.g. `ARROW_ENGINE_EXPORT`) but removed any external facing references.

Closes apache#12915 from westonpace/feature/ARROW-16158--rename-engine-to-substrait

Lead-authored-by: Weston Pace <[email protected]>
Co-authored-by: Neal Richardson <[email protected]>
Signed-off-by: Krisztián Szűcs <[email protected]>
  • Loading branch information
2 people authored and kszucs committed Apr 24, 2022
1 parent 0b06870 commit d21f8b1
Show file tree
Hide file tree
Showing 34 changed files with 216 additions and 190 deletions.
2 changes: 1 addition & 1 deletion ci/appveyor-cpp-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ cmake -G "%GENERATOR%" %CMAKE_ARGS% ^
-DARROW_CXXFLAGS="%ARROW_CXXFLAGS%" ^
-DARROW_DATASET=ON ^
-DARROW_ENABLE_TIMING_TESTS=OFF ^
-DARROW_ENGINE=ON ^
-DARROW_FLIGHT=%ARROW_BUILD_FLIGHT% ^
-DARROW_GANDIVA=%ARROW_BUILD_GANDIVA% ^
-DARROW_MIMALLOC=ON ^
-DARROW_PARQUET=ON ^
-DARROW_PYTHON=ON ^
-DARROW_S3=%ARROW_S3% ^
-DARROW_SUBSTRAIT=ON ^
-DARROW_VERBOSE_THIRDPARTY_BUILD=OFF ^
-DARROW_WITH_BROTLI=ON ^
-DARROW_WITH_LZ4=ON ^
Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ cmake \
-DARROW_DATASET=${ARROW_DATASET:-ON} \
-DARROW_DEPENDENCY_SOURCE=${ARROW_DEPENDENCY_SOURCE:-AUTO} \
-DARROW_ENABLE_TIMING_TESTS=${ARROW_ENABLE_TIMING_TESTS:-ON} \
-DARROW_ENGINE=${ARROW_ENGINE:-ON} \
-DARROW_EXTRA_ERROR_CONTEXT=${ARROW_EXTRA_ERROR_CONTEXT:-OFF} \
-DARROW_FILESYSTEM=${ARROW_FILESYSTEM:-ON} \
-DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \
Expand All @@ -112,6 +111,7 @@ cmake \
-DARROW_RUNTIME_SIMD_LEVEL=${ARROW_RUNTIME_SIMD_LEVEL:-MAX} \
-DARROW_S3=${ARROW_S3:-OFF} \
-DARROW_SKYHOOK=${ARROW_SKYHOOK:-OFF} \
-DARROW_SUBSTRAIT=${ARROW_SUBSTRAIT:-ON} \
-DARROW_TEST_LINKAGE=${ARROW_TEST_LINKAGE:-shared} \
-DARROW_TEST_MEMCHECK=${ARROW_TEST_MEMCHECK:-OFF} \
-DARROW_USE_ASAN=${ARROW_USE_ASAN:-OFF} \
Expand Down
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ if(ARROW_CUDA
set(ARROW_IPC ON)
endif()

if(ARROW_ENGINE)
if(ARROW_SUBSTRAIT)
set(ARROW_PARQUET ON)
set(ARROW_IPC ON)
set(ARROW_COMPUTE ON)
Expand Down
13 changes: 9 additions & 4 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"inherits": "features-basic",
"hidden": true,
"cacheVariables": {
"ARROW_ENGINE": "ON",
"ARROW_SUBSTRAIT": "ON",
"ARROW_MIMALLOC": "ON",
"ARROW_PARQUET": "ON",
"ARROW_WITH_BROTLI": "ON",
Expand Down Expand Up @@ -127,9 +127,14 @@
},
{
"name": "features-maximal",
"inherits": ["features-main", "features-cuda",
"features-filesystems", "features-flight",
"features-gandiva", "features-python"],
"inherits": [
"features-main",
"features-cuda",
"features-filesystems",
"features-flight",
"features-gandiva",
"features-python"
],
"hidden": true,
"displayName": "Debug build with everything enabled (except benchmarks and CUDA)",
"cacheVariables": {
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

define_option(ARROW_DATASET "Build the Arrow Dataset Modules" OFF)

define_option(ARROW_ENGINE "Build the Arrow Query Engine Module" OFF)
define_option(ARROW_SUBSTRAIT "Build the Arrow Substrait Consumer Module" OFF)

define_option(ARROW_FILESYSTEM "Build the Arrow Filesystem Layer" OFF)

Expand Down
88 changes: 0 additions & 88 deletions cpp/cmake_modules/FindArrowEngine.cmake

This file was deleted.

92 changes: 92 additions & 0 deletions cpp/cmake_modules/FindArrowSubstrait.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 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 Substrait (libarrow_substrait.so)
#
# This module requires Arrow from which it uses
# arrow_find_package()
#
# This module defines
# ARROW_SUBSTRAIT_FOUND, whether Arrow Substrait has been found
# ARROW_SUBSTRAIT_IMPORT_LIB,
# path to libarrow_substrait's import library (Windows only)
# ARROW_SUBSTRAIT_INCLUDE_DIR, directory containing headers
# ARROW_SUBSTRAIT_LIB_DIR, directory containing Arrow Substrait libraries
# ARROW_SUBSTRAIT_SHARED_LIB, path to libarrow_substrait's shared library
# ARROW_SUBSTRAIT_STATIC_LIB, path to libarrow_substrait.a

if(DEFINED ARROW_SUBSTRAIT_FOUND)
return()
endif()

set(find_package_arguments)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}")
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
list(APPEND find_package_arguments REQUIRED)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND find_package_arguments QUIET)
endif()
find_package(Arrow ${find_package_arguments})
find_package(Parquet ${find_package_arguments})

if(ARROW_FOUND AND PARQUET_FOUND)
arrow_find_package(ARROW_SUBSTRAIT
"${ARROW_HOME}"
arrow_substrait
arrow/engine/substrait/api.h
ArrowSubstrait
arrow-substrait)
if(NOT ARROW_SUBSTRAIT_VERSION)
set(ARROW_SUBSTRAIT_VERSION "${ARROW_VERSION}")
endif()
endif()

if("${ARROW_SUBSTRAIT_VERSION}" VERSION_EQUAL "${ARROW_VERSION}")
set(ARROW_SUBSTRAIT_VERSION_MATCH TRUE)
else()
set(ARROW_SUBSTRAIT_VERSION_MATCH FALSE)
endif()

mark_as_advanced(ARROW_SUBSTRAIT_IMPORT_LIB
ARROW_SUBSTRAIT_INCLUDE_DIR
ARROW_SUBSTRAIT_LIBS
ARROW_SUBSTRAIT_LIB_DIR
ARROW_SUBSTRAIT_SHARED_IMP_LIB
ARROW_SUBSTRAIT_SHARED_LIB
ARROW_SUBSTRAIT_STATIC_LIB
ARROW_SUBSTRAIT_VERSION
ARROW_SUBSTRAIT_VERSION_MATCH)

find_package_handle_standard_args(
ArrowSubstrait
REQUIRED_VARS ARROW_SUBSTRAIT_INCLUDE_DIR ARROW_SUBSTRAIT_LIB_DIR
ARROW_SUBSTRAIT_VERSION_MATCH
VERSION_VAR ARROW_SUBSTRAIT_VERSION)
set(ARROW_SUBSTRAIT_FOUND ${ArrowSubstrait_FOUND})

if(ArrowSubstrait_FOUND AND NOT ArrowSubstrait_FIND_QUIETLY)
message(STATUS "Found the Arrow Substrait by ${ARROW_SUBSTRAIT_FIND_APPROACH}")
message(STATUS "Found the Arrow Substrait shared library: ${ARROW_SUBSTRAIT_SHARED_LIB}"
)
message(STATUS "Found the Arrow Substrait import library: ${ARROW_SUBSTRAIT_IMPORT_LIB}"
)
message(STATUS "Found the Arrow Substrait static library: ${ARROW_SUBSTRAIT_STATIC_LIB}"
)
endif()
10 changes: 3 additions & 7 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,7 @@ if(ARROW_ORC
set(ARROW_WITH_PROTOBUF ON)
endif()

if(ARROW_ENGINE)
set(ARROW_WITH_SUBSTRAIT ON)
endif()

if(ARROW_WITH_SUBSTRAIT)
if(ARROW_SUBSTRAIT)
set(ARROW_WITH_PROTOBUF ON)
endif()

Expand Down Expand Up @@ -1554,7 +1550,7 @@ if(ARROW_WITH_PROTOBUF)
# google::protobuf::MessageLite::ByteSize() is deprecated since
# Protobuf 3.4.0.
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.4.0")
elseif(ARROW_ENGINE)
elseif(ARROW_SUBSTRAIT)
# Substrait protobuf files use proto3 syntax
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.0.0")
else()
Expand Down Expand Up @@ -1705,7 +1701,7 @@ macro(build_substrait)
list(APPEND ARROW_BUNDLED_STATIC_LIBS substrait)
endmacro()

if(ARROW_WITH_SUBSTRAIT)
if(ARROW_SUBSTRAIT)
# Currently, we can only build Substrait from source.
set(Substrait_SOURCE "BUNDLED")
resolve_dependency(Substrait)
Expand Down
4 changes: 2 additions & 2 deletions cpp/examples/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ if(ARROW_COMPUTE)
add_arrow_example(compute_register_example)
endif()

if(ARROW_ENGINE)
add_arrow_example(engine_substrait_consumption EXTRA_LINK_LIBS arrow_engine_shared)
if(ARROW_SUBSTRAIT)
add_arrow_example(engine_substrait_consumption EXTRA_LINK_LIBS arrow_substrait_shared)
endif()

if(ARROW_COMPUTE AND ARROW_CSV)
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ if(ARROW_COMPUTE)
add_subdirectory(compute)
endif()

if(ARROW_ENGINE)
if(ARROW_SUBSTRAIT)
add_subdirectory(engine)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#
# This config sets the following variables in your project::
#
# ArrowEngine_FOUND - true if Arrow Engine found on the system
# ArrowSubstrait_FOUND - true if Arrow Substrait found on the system
#
# This config sets the following targets in your project::
#
# arrow_engine_shared - for linked as shared library if shared library is built
# arrow_engine_static - for linked as static library if static library is built
# arrow_substrait_shared - for linked as shared library if shared library is built
# arrow_substrait_static - for linked as static library if static library is built

@PACKAGE_INIT@

Expand All @@ -33,6 +33,6 @@ find_dependency(Parquet)

# Load targets only once. If we load targets multiple times, CMake reports
# already existent target error.
if(NOT (TARGET arrow_engine_shared OR TARGET arrow_engine_static))
include("${CMAKE_CURRENT_LIST_DIR}/ArrowEngineTargets.cmake")
if(NOT (TARGET arrow_substrait_shared OR TARGET arrow_substrait_static))
include("${CMAKE_CURRENT_LIST_DIR}/ArrowSubstraitTargets.cmake")
endif()
Loading

0 comments on commit d21f8b1

Please sign in to comment.