diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 462581c3f4738..66a176b80c02e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -289,6 +289,11 @@ Always OFF if building binaries" set(PARQUET_ARROW_LINKAGE "shared" CACHE STRING "How to link Arrow libraries with libparquet.so. static|shared (default shared)") + # Gandiva related build options + option(ARROW_GANDIVA + "Build the Gandiva libraries" + OFF) + endif() if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS) @@ -746,3 +751,7 @@ endif() if(ARROW_PARQUET) add_subdirectory(src/parquet) endif() + +if(ARROW_GANDIVA) + add_subdirectory(src/gandiva) +endif() diff --git a/cpp/cmake_modules/FindLLVM.cmake b/cpp/cmake_modules/FindLLVM.cmake new file mode 100644 index 0000000000000..feceee77cdfc9 --- /dev/null +++ b/cpp/cmake_modules/FindLLVM.cmake @@ -0,0 +1,43 @@ +# 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. +# +# Usage of this module as follows: +# +# find_package(LLVM) +# + +set(GANDIVA_LLVM_VERSION 6.0) +find_package(LLVM ${GANDIVA_LLVM_VERSION} REQUIRED CONFIG HINTS + /usr/local/opt/llvm + /usr/share) +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + +# Find the libraries that correspond to the LLVM components +llvm_map_components_to_libnames(LLVM_LIBS core mcjit native ipo bitreader target linker analysis debuginfodwarf) + +set(CLANG_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/clang CACHE STRING "clang") +set(LINK_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/llvm-link CACHE STRING "link") +set(CLANG_FORMAT_EXECUTABLE ${LLVM_TOOLS_BINARY_DIR}/clang-format CACHE STRING "clang-format") + +add_library(LLVM::LLVM_INTERFACE INTERFACE IMPORTED) + +set_target_properties(LLVM::LLVM_INTERFACE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LLVM_INCLUDE_DIRS}" + INTERFACE_COMPILE_FLAGS "${LLVM_DEFINITIONS}" + INTERFACE_LINK_LIBRARIES "${LLVM_LIBS}" +) diff --git a/cpp/cmake_modules/FindProtobuf.cmake b/cpp/cmake_modules/FindProtobuf.cmake index 9591bd1eb70c0..a82d7bcdaa19b 100644 --- a/cpp/cmake_modules/FindProtobuf.cmake +++ b/cpp/cmake_modules/FindProtobuf.cmake @@ -99,3 +99,4 @@ mark_as_advanced ( PROTOBUF_STATIC_LIB PROTOC_STATIC_LIB ) + diff --git a/cpp/cmake_modules/GandivaBuildUtils.cmake b/cpp/cmake_modules/GandivaBuildUtils.cmake new file mode 100644 index 0000000000000..2b0f05256c3aa --- /dev/null +++ b/cpp/cmake_modules/GandivaBuildUtils.cmake @@ -0,0 +1,175 @@ +# 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. + +# Build the gandiva library +function(build_gandiva_lib TYPE ARROW) + string(TOUPPER ${TYPE} TYPE_UPPER_CASE) + add_library(gandiva_${TYPE} ${TYPE_UPPER_CASE} $) + + target_include_directories(gandiva_${TYPE} + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src + ) + + # ARROW is a public dependency i.e users of gandiva also will have a dependency on arrow. + target_link_libraries(gandiva_${TYPE} + PUBLIC + ARROW + PRIVATE + Boost::boost + Boost::regex + Boost::system + Boost::filesystem + LLVM::LLVM_INTERFACE + ${RE2_STATIC_LIB}) + + if (${TYPE} MATCHES "static" AND NOT APPLE) + target_link_libraries(gandiva_${TYPE} + LINK_PRIVATE + -static-libstdc++ -static-libgcc) + endif() + + # Set version for the library. + set(GANDIVA_VERSION_MAJOR 0) + set(GANDIVA_VERSION_MINOR 1) + set(GANDIVA_VERSION_PATCH 0) + set(GANDIVA_VERSION ${GANDIVA_VERSION_MAJOR}.${GANDIVA_VERSION_MINOR}.${GANDIVA_VERSION_PATCH}) + + set_target_properties(gandiva_${TYPE} PROPERTIES + VERSION ${GANDIVA_VERSION} + SOVERSION ${GANDIVA_VERSION_MAJOR} + OUTPUT_NAME gandiva + ) +endfunction(build_gandiva_lib TYPE) + +# Add a unittest executable, with its dependencies. +function(add_gandiva_unit_test REL_TEST_NAME) + get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE) + + add_executable(${TEST_NAME} ${REL_TEST_NAME} ${ARGN}) + if(${REL_TEST_NAME} MATCHES "llvm" OR + ${REL_TEST_NAME} MATCHES "expression_registry") + # If the unit test has llvm in its name, include llvm. + add_dependencies(${TEST_NAME} LLVM::LLVM_INTERFACE) + target_link_libraries(${TEST_NAME} PRIVATE LLVM::LLVM_INTERFACE) + endif() + + target_include_directories(${TEST_NAME} PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/src + ) + target_link_libraries(${TEST_NAME} + PRIVATE arrow_shared ${GTEST_STATIC_LIB} ${GTEST_MAIN_STATIC_LIB} ${RE2_STATIC_LIB} Boost::boost + ) + add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) + set_property(TEST ${TEST_NAME} PROPERTY LABELS unittest ${TEST_NAME}) +endfunction(add_gandiva_unit_test REL_TEST_NAME) + +# Add a unittest executable for a precompiled file (used to generate IR) +function(add_precompiled_unit_test REL_TEST_NAME) + get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE) + + add_executable(${TEST_NAME} ${REL_TEST_NAME} ${ARGN}) + target_include_directories(${TEST_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src) + target_link_libraries(${TEST_NAME} PRIVATE ${RE2_STATIC_LIB} ${GTEST_STATIC_LIB} ${GTEST_MAIN_STATIC_LIB}) + target_compile_definitions(${TEST_NAME} PRIVATE GANDIVA_UNIT_TEST=1) + add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) + set_property(TEST ${TEST_NAME} PROPERTY LABELS unittest ${TEST_NAME}) +endfunction(add_precompiled_unit_test REL_TEST_NAME) + +# Add an integ executable, with its dependencies. +function(add_gandiva_integ_test REL_TEST_NAME GANDIVA_LIB) + get_filename_component(TEST_NAME ${REL_TEST_NAME} NAME_WE) + + add_executable(${TEST_NAME}_${GANDIVA_LIB} ${REL_TEST_NAME} ${ARGN}) + target_include_directories(${TEST_NAME}_${GANDIVA_LIB} PRIVATE ${CMAKE_SOURCE_DIR}) + target_link_libraries(${TEST_NAME}_${GANDIVA_LIB} PRIVATE ${GANDIVA_LIB} ${GTEST_STATIC_LIB} ${GTEST_MAIN_STATIC_LIB}) + + add_test(NAME ${TEST_NAME}_${GANDIVA_LIB} COMMAND ${TEST_NAME}_${GANDIVA_LIB}) + set_property(TEST ${TEST_NAME}_${GANDIVA_LIB} PROPERTY LABELS integ ${TEST_NAME}_${GANDIVA_LIB}) +endfunction(add_gandiva_integ_test REL_TEST_NAME) + +# Download and build external project. +function(build_external PROJ) + message("Building ${PROJ} as external project") + # configure the download + configure_file(${CMAKE_SOURCE_DIR}/cmake/${PROJ}-CMakeLists.txt.in ${CMAKE_BINARY_DIR}/${PROJ}-download/CMakeLists.txt) + execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJ}-download ) + if(result) + message(FATAL_ERROR "CMake step for ${PROJ} failed: ${result}") + endif(result) + + # unpack + execute_process(COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJ}-download ) + if(result) + message(FATAL_ERROR "Build step for ${PROJ} failed: ${result}") + endif(result) + + # Add project directly to the build. + add_subdirectory(${CMAKE_BINARY_DIR}/${PROJ}-src + ${CMAKE_BINARY_DIR}/${PROJ}-build + EXCLUDE_FROM_ALL) +endfunction(build_external PROJ) + +file(GLOB_RECURSE LINT_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc" + "${CMAKE_CURRENT_SOURCE_DIR}/integ/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/integ/*.cc" +) + +# Add "make stylecheck" target +function(add_stylecheck) + if (UNIX) + add_custom_target(stylecheck + COMMENT "Performing stylecheck on all .cpp/.h files" + # use ! to check for no replacement + COMMAND ! + ${CLANG_FORMAT_EXECUTABLE} + -style=file + -output-replacements-xml + ${LINT_FILES} + | grep "replacement offset" + ) + endif (UNIX) +endfunction(add_stylecheck) + +# Add "make stylefix" target +function(add_stylefix) + if (UNIX) + add_custom_target(stylefix + COMMENT "Performing stylefix on all .cpp/.h files" + COMMAND + echo ${LINT_FILES} | xargs ${CLANG_FORMAT_EXECUTABLE} -style=file -i + ) + endif (UNIX) +endfunction(add_stylefix) + +function(prevent_in_source_builds) + file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH) + if(EXISTS "${LOC_PATH}") + message(FATAL_ERROR "Gandiva does not support in-source builds") + endif() +endfunction(prevent_in_source_builds) diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt deleted file mode 100644 index cc6d5f0283ead..0000000000000 --- a/cpp/src/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2017-2018 Dremio Corporation -# -# Licensed 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. - -cmake_minimum_required(VERSION 3.10) - -project(gandiva) - -# LLVM/Clang is required by multiple subdirs. -find_package(LLVM) - -find_package(RE2) - -# Set the path where the byte-code files will be installed. -set(GANDIVA_BC_INSTALL_DIR - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/gandiva) - -set(GANDIVA_BC_FILE_NAME irhelpers.bc) -set(GANDIVA_BC_INSTALL_PATH ${GANDIVA_BC_INSTALL_DIR}/${GANDIVA_BC_FILE_NAME}) -set(GANDIVA_BC_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${GANDIVA_BC_FILE_NAME}) - -# Set the path where the so lib file will be installed. -if (APPLE) - set(GANDIVA_HELPER_LIB_FILE_NAME libgandiva_helpers.dylib) -else() - set(GANDIVA_HELPER_LIB_FILE_NAME libgandiva_helpers.so) -endif(APPLE) - -set(GANDIVA_HELPER_LIB_INSTALL_PATH ${GANDIVA_BC_INSTALL_DIR}/${GANDIVA_HELPER_LIB_FILE_NAME}) -set(GANDIVA_HELPER_LIB_OUTPUT_PATH ${CMAKE_BINARY_DIR}/src/codegen/${GANDIVA_HELPER_LIB_FILE_NAME}) - -add_subdirectory(codegen) -add_subdirectory(jni) -add_subdirectory(precompiled) diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 5a5da6b3c7406..6165b7177ddb0 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -12,12 +12,34 @@ # See the License for the specific language governing permissions and # limitations under the License. +# LLVM/Clang is required by multiple subdirs. +cmake_minimum_required(VERSION 3.11) + project(gandiva) -# Find arrow -find_package(ARROW) +include(GandivaBuildUtils) + +find_package(LLVM) + +find_package(RE2) + +# Set the path where the byte-code files will be installed. +set(GANDIVA_BC_INSTALL_DIR + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/gandiva) + +set(GANDIVA_BC_FILE_NAME irhelpers.bc) +set(GANDIVA_BC_INSTALL_PATH ${GANDIVA_BC_INSTALL_DIR}/${GANDIVA_BC_FILE_NAME}) +set(GANDIVA_BC_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${GANDIVA_BC_FILE_NAME}) -find_package(Boost COMPONENTS system regex filesystem REQUIRED) +# Set the path where the so lib file will be installed. +if (APPLE) + set(GANDIVA_HELPER_LIB_FILE_NAME libgandiva_helpers.dylib) +else() + set(GANDIVA_HELPER_LIB_FILE_NAME libgandiva_helpers.so) +endif(APPLE) + +set(GANDIVA_HELPER_LIB_INSTALL_PATH ${GANDIVA_BC_INSTALL_DIR}/${GANDIVA_HELPER_LIB_FILE_NAME}) +set(GANDIVA_HELPER_LIB_OUTPUT_PATH ${CMAKE_BINARY_DIR}/debug/${GANDIVA_HELPER_LIB_FILE_NAME}) set(BC_FILE_PATH_CC "${CMAKE_CURRENT_BINARY_DIR}/bc_file_path.cc") configure_file(bc_file_path.cc.in ${BC_FILE_PATH_CC}) @@ -63,29 +85,14 @@ target_include_directories(gandiva_obj_lib PRIVATE ${CMAKE_SOURCE_DIR}/src $ - $ + ${ARROW_INCLUDE_DIR} $ $ ) -build_gandiva_lib("shared") - -build_gandiva_lib("static") - -# install for gandiva -include(GNUInstallDirs) - -# install libgandiva -install( - TARGETS gandiva_shared gandiva_static - DESTINATION ${CMAKE_INSTALL_LIBDIR} -) +build_gandiva_lib("shared" arrow_shared) -# install the header files. -install( - DIRECTORY ${CMAKE_SOURCE_DIR}/include/gandiva - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) +build_gandiva_lib("static" arrow_static) # Pre-compiled .so library for function helpers. add_library(gandiva_helpers SHARED @@ -100,14 +107,41 @@ target_include_directories(gandiva_helpers PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src - $ + ${ARROW_INCLUDE_DIR} ) -target_link_libraries(gandiva_helpers PRIVATE Boost::boost RE2::RE2_STATIC) +target_link_libraries(gandiva_helpers PRIVATE Boost::boost ${RE2_STATIC_LIB}) if (NOT APPLE) target_link_libraries(gandiva_helpers LINK_PRIVATE -static-libstdc++ -static-libgcc) endif() +# install for gandiva +include(GNUInstallDirs) + +# install libgandiva +install( + TARGETS gandiva_shared gandiva_static gandiva_helpers + DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +# install the header files. +install(FILES + arrow.h + condition.h + configuration.h + expression.h + expression_registry.h + filter.h + function_signature.h + gandiva_aliases.h + logging.h + projector.h + selection_vector.h + status.h + tree_expr_builder.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + #args: label test-file src-files add_gandiva_unit_test(bitmap_accumulator_test.cc bitmap_accumulator.cc) add_gandiva_unit_test(engine_llvm_test.cc engine.cc llvm_types.cc configuration.cc ${BC_FILE_PATH_CC}) @@ -123,3 +157,15 @@ add_gandiva_unit_test(expression_registry_test.cc llvm_types.cc expression_regis add_gandiva_unit_test(selection_vector_test.cc selection_vector.cc) add_gandiva_unit_test(lru_cache_test.cc) add_gandiva_unit_test(like_holder_test.cc like_holder.cc regex_util.cc) + +add_subdirectory(jni) +add_subdirectory(precompiled) + +include(CTest) +enable_testing() + +add_subdirectory(tests) + +add_stylecheck() # "make stylecheck" target +add_stylefix() # "make stylefix" target + diff --git a/cpp/src/gandiva/annotator.cc b/cpp/src/gandiva/annotator.cc index afd0e269b511c..67ad566884c18 100644 --- a/cpp/src/gandiva/annotator.cc +++ b/cpp/src/gandiva/annotator.cc @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/annotator.h" +#include "gandiva/annotator.h" #include #include -#include "codegen/field_descriptor.h" +#include "gandiva/field_descriptor.h" namespace gandiva { diff --git a/cpp/src/gandiva/annotator.h b/cpp/src/gandiva/annotator.h index 7a363c9841003..b890d8d0987ff 100644 --- a/cpp/src/gandiva/annotator.h +++ b/cpp/src/gandiva/annotator.h @@ -20,7 +20,7 @@ #include #include -#include "codegen/eval_batch.h" +#include "gandiva/eval_batch.h" #include "gandiva/arrow.h" #include "gandiva/gandiva_aliases.h" #include "gandiva/logging.h" diff --git a/cpp/src/gandiva/annotator_test.cc b/cpp/src/gandiva/annotator_test.cc index b26807e9c5b96..9288d5c95656e 100644 --- a/cpp/src/gandiva/annotator_test.cc +++ b/cpp/src/gandiva/annotator_test.cc @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/annotator.h" +#include "gandiva/annotator.h" #include #include #include -#include "codegen/field_descriptor.h" +#include "gandiva/field_descriptor.h" namespace gandiva { diff --git a/cpp/src/gandiva/bitmap_accumulator.cc b/cpp/src/gandiva/bitmap_accumulator.cc index b4e7a496f9e87..153e3e87e3d99 100644 --- a/cpp/src/gandiva/bitmap_accumulator.cc +++ b/cpp/src/gandiva/bitmap_accumulator.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/bitmap_accumulator.h" +#include "gandiva/bitmap_accumulator.h" #include diff --git a/cpp/src/gandiva/bitmap_accumulator.h b/cpp/src/gandiva/bitmap_accumulator.h index 94c31092d2e49..26b252df29e97 100644 --- a/cpp/src/gandiva/bitmap_accumulator.h +++ b/cpp/src/gandiva/bitmap_accumulator.h @@ -17,9 +17,9 @@ #include -#include "codegen/dex.h" -#include "codegen/dex_visitor.h" -#include "codegen/eval_batch.h" +#include "gandiva/dex.h" +#include "gandiva/dex_visitor.h" +#include "gandiva/eval_batch.h" namespace gandiva { diff --git a/cpp/src/gandiva/bitmap_accumulator_test.cc b/cpp/src/gandiva/bitmap_accumulator_test.cc index 1d81dcdb89eec..da36394fe055f 100644 --- a/cpp/src/gandiva/bitmap_accumulator_test.cc +++ b/cpp/src/gandiva/bitmap_accumulator_test.cc @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/bitmap_accumulator.h" +#include "gandiva/bitmap_accumulator.h" #include #include #include -#include "codegen/dex.h" +#include "gandiva/dex.h" namespace gandiva { diff --git a/cpp/src/gandiva/cache.h b/cpp/src/gandiva/cache.h index 2aa8354a5dd7c..b41728b8550cd 100644 --- a/cpp/src/gandiva/cache.h +++ b/cpp/src/gandiva/cache.h @@ -17,7 +17,7 @@ #include -#include "codegen/lru_cache.h" +#include "gandiva/lru_cache.h" namespace gandiva { diff --git a/cpp/src/gandiva/compiled_expr.h b/cpp/src/gandiva/compiled_expr.h index 6148c8950cea6..b18161716a409 100644 --- a/cpp/src/gandiva/compiled_expr.h +++ b/cpp/src/gandiva/compiled_expr.h @@ -16,7 +16,7 @@ #define GANDIVA_COMPILED_EXPR_H #include -#include "codegen/value_validity_pair.h" +#include "gandiva/value_validity_pair.h" namespace gandiva { diff --git a/cpp/src/gandiva/dex.h b/cpp/src/gandiva/dex.h index 4484d37db165c..d43352cade544 100644 --- a/cpp/src/gandiva/dex.h +++ b/cpp/src/gandiva/dex.h @@ -18,13 +18,13 @@ #include #include -#include "codegen/dex_visitor.h" -#include "codegen/field_descriptor.h" -#include "codegen/func_descriptor.h" -#include "codegen/function_holder.h" -#include "codegen/literal_holder.h" -#include "codegen/native_function.h" -#include "codegen/value_validity_pair.h" +#include "gandiva/dex_visitor.h" +#include "gandiva/field_descriptor.h" +#include "gandiva/func_descriptor.h" +#include "gandiva/function_holder.h" +#include "gandiva/literal_holder.h" +#include "gandiva/native_function.h" +#include "gandiva/value_validity_pair.h" #include "gandiva/gandiva_aliases.h" namespace gandiva { diff --git a/cpp/src/gandiva/engine.cc b/cpp/src/gandiva/engine.cc index 29748a3455f75..745ef4e068d74 100644 --- a/cpp/src/gandiva/engine.cc +++ b/cpp/src/gandiva/engine.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/engine.h" +#include "gandiva/engine.h" #include #include diff --git a/cpp/src/gandiva/engine_llvm_test.cc b/cpp/src/gandiva/engine_llvm_test.cc index ee5e74cb581d5..7942b9ceaee8a 100644 --- a/cpp/src/gandiva/engine_llvm_test.cc +++ b/cpp/src/gandiva/engine_llvm_test.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/engine.h" +#include "gandiva/engine.h" #include -#include "codegen/llvm_types.h" +#include "gandiva/llvm_types.h" namespace gandiva { diff --git a/cpp/src/gandiva/expr_decomposer.cc b/cpp/src/gandiva/expr_decomposer.cc index d477407c76e2e..4b50779225804 100644 --- a/cpp/src/gandiva/expr_decomposer.cc +++ b/cpp/src/gandiva/expr_decomposer.cc @@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/expr_decomposer.h" +#include "gandiva/expr_decomposer.h" #include #include #include #include -#include "codegen/annotator.h" -#include "codegen/dex.h" -#include "codegen/function_holder_registry.h" -#include "codegen/function_registry.h" -#include "codegen/node.h" +#include "gandiva/annotator.h" +#include "gandiva/dex.h" +#include "gandiva/function_holder_registry.h" +#include "gandiva/function_registry.h" +#include "gandiva/node.h" #include "gandiva/function_signature.h" namespace gandiva { diff --git a/cpp/src/gandiva/expr_decomposer.h b/cpp/src/gandiva/expr_decomposer.h index 12fcd9e3baf00..952b6e46f74ee 100644 --- a/cpp/src/gandiva/expr_decomposer.h +++ b/cpp/src/gandiva/expr_decomposer.h @@ -20,8 +20,8 @@ #include #include -#include "codegen/node.h" -#include "codegen/node_visitor.h" +#include "gandiva/node.h" +#include "gandiva/node_visitor.h" #include "gandiva/expression.h" namespace gandiva { diff --git a/cpp/src/gandiva/expr_decomposer_test.cc b/cpp/src/gandiva/expr_decomposer_test.cc index 463529e69278a..b914709d9cefe 100644 --- a/cpp/src/gandiva/expr_decomposer_test.cc +++ b/cpp/src/gandiva/expr_decomposer_test.cc @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/expr_decomposer.h" +#include "gandiva/expr_decomposer.h" #include -#include "codegen/annotator.h" -#include "codegen/dex.h" -#include "codegen/function_registry.h" -#include "codegen/node.h" +#include "gandiva/annotator.h" +#include "gandiva/dex.h" +#include "gandiva/function_registry.h" +#include "gandiva/node.h" #include "gandiva/function_signature.h" #include "gandiva/gandiva_aliases.h" #include "gandiva/tree_expr_builder.h" diff --git a/cpp/src/gandiva/expr_validator.cc b/cpp/src/gandiva/expr_validator.cc index 9ca286206e73d..5160c0238fb32 100644 --- a/cpp/src/gandiva/expr_validator.cc +++ b/cpp/src/gandiva/expr_validator.cc @@ -16,7 +16,7 @@ #include #include -#include "codegen/expr_validator.h" +#include "gandiva/expr_validator.h" namespace gandiva { diff --git a/cpp/src/gandiva/expr_validator.h b/cpp/src/gandiva/expr_validator.h index 83d3d2a221571..4fc0d2c684140 100644 --- a/cpp/src/gandiva/expr_validator.h +++ b/cpp/src/gandiva/expr_validator.h @@ -19,10 +19,10 @@ #include #include "boost/functional/hash.hpp" -#include "codegen/function_registry.h" -#include "codegen/llvm_types.h" -#include "codegen/node.h" -#include "codegen/node_visitor.h" +#include "gandiva/function_registry.h" +#include "gandiva/llvm_types.h" +#include "gandiva/node.h" +#include "gandiva/node_visitor.h" #include "gandiva/arrow.h" #include "gandiva/expression.h" #include "gandiva/status.h" diff --git a/cpp/src/gandiva/expression.cc b/cpp/src/gandiva/expression.cc index 35d995e1f241a..c36eed8d7787c 100644 --- a/cpp/src/gandiva/expression.cc +++ b/cpp/src/gandiva/expression.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "gandiva/expression.h" -#include "codegen/node.h" +#include "gandiva/node.h" namespace gandiva { diff --git a/cpp/src/gandiva/expression_registry.cc b/cpp/src/gandiva/expression_registry.cc index 0a5875b5b9341..d01f3650ef788 100644 --- a/cpp/src/gandiva/expression_registry.cc +++ b/cpp/src/gandiva/expression_registry.cc @@ -16,8 +16,8 @@ #include "boost/iterator/transform_iterator.hpp" -#include "codegen/function_registry.h" -#include "codegen/llvm_types.h" +#include "gandiva/function_registry.h" +#include "gandiva/llvm_types.h" namespace gandiva { diff --git a/cpp/src/gandiva/expression_registry_test.cc b/cpp/src/gandiva/expression_registry_test.cc index 95b8fa732c9dd..39b453f9f248e 100644 --- a/cpp/src/gandiva/expression_registry_test.cc +++ b/cpp/src/gandiva/expression_registry_test.cc @@ -18,8 +18,8 @@ #include #include -#include "codegen/function_registry.h" -#include "codegen/llvm_types.h" +#include "gandiva/function_registry.h" +#include "gandiva/llvm_types.h" #include "gandiva/function_signature.h" namespace gandiva { diff --git a/cpp/src/gandiva/filter.cc b/cpp/src/gandiva/filter.cc index b9255d98c1c9e..0409d1cc1862a 100644 --- a/cpp/src/gandiva/filter.cc +++ b/cpp/src/gandiva/filter.cc @@ -18,12 +18,12 @@ #include #include -#include "codegen/bitmap_accumulator.h" -#include "codegen/cache.h" -#include "codegen/expr_validator.h" -#include "codegen/filter_cache_key.h" -#include "codegen/llvm_generator.h" -#include "codegen/selection_vector_impl.h" +#include "gandiva/bitmap_accumulator.h" +#include "gandiva/cache.h" +#include "gandiva/expr_validator.h" +#include "gandiva/filter_cache_key.h" +#include "gandiva/llvm_generator.h" +#include "gandiva/selection_vector_impl.h" #include "gandiva/condition.h" #include "gandiva/status.h" diff --git a/cpp/src/gandiva/function_holder_registry.h b/cpp/src/gandiva/function_holder_registry.h index 876bfee3ecf30..8d228cd8e531d 100644 --- a/cpp/src/gandiva/function_holder_registry.h +++ b/cpp/src/gandiva/function_holder_registry.h @@ -15,9 +15,9 @@ #ifndef GANDIVA_FUNCTION_HOLDER_REGISTRY_H #define GANDIVA_FUNCTION_HOLDER_REGISTRY_H -#include "codegen/function_holder.h" -#include "codegen/like_holder.h" -#include "codegen/node.h" +#include "gandiva/function_holder.h" +#include "gandiva/like_holder.h" +#include "gandiva/node.h" #include "gandiva/status.h" namespace gandiva { diff --git a/cpp/src/gandiva/function_holder_stubs.cc b/cpp/src/gandiva/function_holder_stubs.cc index 45d8c4b5f5563..c04c8eaaa9e35 100644 --- a/cpp/src/gandiva/function_holder_stubs.cc +++ b/cpp/src/gandiva/function_holder_stubs.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/like_holder.h" +#include "gandiva/like_holder.h" // Wrapper C functions for "like" to be invoked from LLVM. extern "C" bool like_utf8_utf8(int64_t ptr, const char *data, int data_len, diff --git a/cpp/src/gandiva/function_registry.cc b/cpp/src/gandiva/function_registry.cc index 86f2f8cb218af..268f57256b6d3 100644 --- a/cpp/src/gandiva/function_registry.cc +++ b/cpp/src/gandiva/function_registry.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/function_registry.h" +#include "gandiva/function_registry.h" #include diff --git a/cpp/src/gandiva/function_registry.h b/cpp/src/gandiva/function_registry.h index 27f749da01883..3fdb2074ec72d 100644 --- a/cpp/src/gandiva/function_registry.h +++ b/cpp/src/gandiva/function_registry.h @@ -17,7 +17,7 @@ #include -#include "codegen/native_function.h" +#include "gandiva/native_function.h" #include "gandiva/gandiva_aliases.h" namespace gandiva { diff --git a/cpp/src/gandiva/function_registry_test.cc b/cpp/src/gandiva/function_registry_test.cc index 7d3a7230a0fe0..6b7d5c7f67a06 100644 --- a/cpp/src/gandiva/function_registry_test.cc +++ b/cpp/src/gandiva/function_registry_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/function_registry.h" +#include "gandiva/function_registry.h" #include diff --git a/cpp/src/gandiva/jni/CMakeLists.txt b/cpp/src/gandiva/jni/CMakeLists.txt index e119b663947db..e96b3fb91dc67 100644 --- a/cpp/src/gandiva/jni/CMakeLists.txt +++ b/cpp/src/gandiva/jni/CMakeLists.txt @@ -21,12 +21,29 @@ find_package(Protobuf REQUIRED) # Find JNI find_package(JNI REQUIRED) -# generate the protobuf files from the proto definition. -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/../proto/Types.proto) +set(PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(PROTO_OUTPUT_FILES "${PROTO_OUTPUT_DIR}/types.pb.cc") +set(PROTO_OUTPUT_FILES ${PROTO_OUTPUT_FILES} "${PROTO_OUTPUT_DIR}/types.pb.h") + +set_source_files_properties(${PROTO_OUTPUT_FILES} PROPERTIES GENERATED TRUE) + +get_filename_component(ABS_GANDIVA_PROTO ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto ABSOLUTE) + +add_custom_command( + OUTPUT ${PROTO_OUTPUT_FILES} + COMMAND ${PROTOBUF_EXECUTABLE} --proto_path ${CMAKE_SOURCE_DIR}/src/gandiva/proto --cpp_out ${PROTO_OUTPUT_DIR} ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto + DEPENDS ${ABS_GANDIVA_PROTO} + COMMENT "Running PROTO compiler on Types.proto" + VERBATIM +) + +add_custom_target(gandiva_jni_proto ALL DEPENDS ${PROTO_OUTPUT_FILES}) +set(PROTO_SRCS "${PROTO_OUTPUT_DIR}/types.pb.cc") +set(PROTO_HDRS "${PROTO_OUTPUT_DIR}/types.pb.h") # Create the jni header file (from the java class). set(JNI_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/java") -add_subdirectory(../../../java ./java) +add_subdirectory(../../../../java/gandiva ./java/gandiva) add_library(gandiva_jni SHARED config_builder.cc @@ -35,7 +52,7 @@ add_library(gandiva_jni SHARED jni_common.cc ${PROTO_SRCS} ${PROTO_HDRS}) -add_dependencies(gandiva_jni gandiva_java) +add_dependencies(gandiva_jni gandiva_java gandiva_jni_proto) # For users of gandiva_jni library (including integ tests), include-dir is : # /usr/**/include dir after install, @@ -56,6 +73,6 @@ target_include_directories(gandiva_jni # PROTOBUF is a private dependency i.e users of gandiva also will not have a dependency on protobuf. target_link_libraries(gandiva_jni PRIVATE - protobuf::libprotobuf + ${PROTOBUF_STATIC_LIB} gandiva_static ) diff --git a/cpp/src/gandiva/jni/config_builder.cc b/cpp/src/gandiva/jni/config_builder.cc index 5cc9c7ce1aa08..ecee00b7a3704 100644 --- a/cpp/src/gandiva/jni/config_builder.cc +++ b/cpp/src/gandiva/jni/config_builder.cc @@ -14,8 +14,8 @@ #include #include "gandiva/configuration.h" -#include "jni/config_holder.h" -#include "jni/env_helper.h" +#include "gandiva/jni/config_holder.h" +#include "gandiva/jni/env_helper.h" #include "jni/org_apache_arrow_gandiva_evaluator_ConfigurationBuilder.h" using gandiva::ConfigHolder; diff --git a/cpp/src/gandiva/jni/config_holder.cc b/cpp/src/gandiva/jni/config_holder.cc index a0938003b009b..6493cd62e0649 100644 --- a/cpp/src/gandiva/jni/config_holder.cc +++ b/cpp/src/gandiva/jni/config_holder.cc @@ -11,7 +11,7 @@ // 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. -#include "jni/config_holder.h" +#include "gandiva/jni/config_holder.h" #include diff --git a/cpp/src/gandiva/jni/jni_common.cc b/cpp/src/gandiva/jni/jni_common.cc index 1abecf1b9b7b9..3f0c4827ddf84 100644 --- a/cpp/src/gandiva/jni/jni_common.cc +++ b/cpp/src/gandiva/jni/jni_common.cc @@ -30,10 +30,10 @@ #include "gandiva/filter.h" #include "gandiva/projector.h" #include "gandiva/tree_expr_builder.h" -#include "jni/config_holder.h" -#include "jni/env_helper.h" -#include "jni/id_to_module_map.h" -#include "jni/module_holder.h" +#include "gandiva/jni/config_holder.h" +#include "gandiva/jni/env_helper.h" +#include "gandiva/jni/id_to_module_map.h" +#include "gandiva/jni/module_holder.h" #include "jni/org_apache_arrow_gandiva_evaluator_JniWrapper.h" using gandiva::ConditionPtr; diff --git a/cpp/src/gandiva/like_holder.cc b/cpp/src/gandiva/like_holder.cc index 75f4229c4c8eb..c24494e4665f6 100644 --- a/cpp/src/gandiva/like_holder.cc +++ b/cpp/src/gandiva/like_holder.cc @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/like_holder.h" +#include "gandiva/like_holder.h" #include -#include "codegen/node.h" -#include "codegen/regex_util.h" +#include "gandiva/node.h" +#include "gandiva/regex_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/like_holder.h b/cpp/src/gandiva/like_holder.h index c3f665834611a..1a3f5f9ca72f6 100644 --- a/cpp/src/gandiva/like_holder.h +++ b/cpp/src/gandiva/like_holder.h @@ -16,8 +16,8 @@ #define GANDIVA_LIKE_HOLDER_H #include -#include "codegen/function_holder.h" -#include "codegen/node.h" +#include "gandiva/function_holder.h" +#include "gandiva/node.h" #include "gandiva/status.h" namespace gandiva { diff --git a/cpp/src/gandiva/like_holder_test.cc b/cpp/src/gandiva/like_holder_test.cc index 8b3a430be1373..02eebbd71d0c7 100644 --- a/cpp/src/gandiva/like_holder_test.cc +++ b/cpp/src/gandiva/like_holder_test.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/like_holder.h" -#include "codegen/regex_util.h" +#include "gandiva/like_holder.h" +#include "gandiva/regex_util.h" #include #include diff --git a/cpp/src/gandiva/llvm_generator.cc b/cpp/src/gandiva/llvm_generator.cc index 8a5f267ad74ae..786cffb83e475 100644 --- a/cpp/src/gandiva/llvm_generator.cc +++ b/cpp/src/gandiva/llvm_generator.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/llvm_generator.h" +#include "gandiva/llvm_generator.h" #include #include @@ -20,11 +20,11 @@ #include #include -#include "codegen/bitmap_accumulator.h" -#include "codegen/dex.h" -#include "codegen/expr_decomposer.h" -#include "codegen/function_registry.h" -#include "codegen/lvalue.h" +#include "gandiva/bitmap_accumulator.h" +#include "gandiva/dex.h" +#include "gandiva/expr_decomposer.h" +#include "gandiva/function_registry.h" +#include "gandiva/lvalue.h" #include "gandiva/expression.h" namespace gandiva { diff --git a/cpp/src/gandiva/llvm_generator.h b/cpp/src/gandiva/llvm_generator.h index 7ad23524cdde0..80aba9f8c63fd 100644 --- a/cpp/src/gandiva/llvm_generator.h +++ b/cpp/src/gandiva/llvm_generator.h @@ -21,14 +21,14 @@ #include #include -#include "codegen/annotator.h" -#include "codegen/compiled_expr.h" -#include "codegen/dex_visitor.h" -#include "codegen/engine.h" -#include "codegen/function_registry.h" -#include "codegen/llvm_types.h" -#include "codegen/lvalue.h" -#include "codegen/value_validity_pair.h" +#include "gandiva/annotator.h" +#include "gandiva/compiled_expr.h" +#include "gandiva/dex_visitor.h" +#include "gandiva/engine.h" +#include "gandiva/function_registry.h" +#include "gandiva/llvm_types.h" +#include "gandiva/lvalue.h" +#include "gandiva/value_validity_pair.h" #include "gandiva/configuration.h" #include "gandiva/gandiva_aliases.h" diff --git a/cpp/src/gandiva/llvm_generator_test.cc b/cpp/src/gandiva/llvm_generator_test.cc index 3e3945314b98c..ede98a9f8f91d 100644 --- a/cpp/src/gandiva/llvm_generator_test.cc +++ b/cpp/src/gandiva/llvm_generator_test.cc @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/llvm_generator.h" +#include "gandiva/llvm_generator.h" #include #include #include -#include "codegen/dex.h" -#include "codegen/func_descriptor.h" -#include "codegen/function_registry.h" +#include "gandiva/dex.h" +#include "gandiva/func_descriptor.h" +#include "gandiva/function_registry.h" #include "gandiva/configuration.h" #include "gandiva/expression.h" diff --git a/cpp/src/gandiva/llvm_types.cc b/cpp/src/gandiva/llvm_types.cc index 3b474f39ac867..3c33edc64a2c8 100644 --- a/cpp/src/gandiva/llvm_types.cc +++ b/cpp/src/gandiva/llvm_types.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/llvm_types.h" +#include "gandiva/llvm_types.h" namespace gandiva { diff --git a/cpp/src/gandiva/llvm_types_test.cc b/cpp/src/gandiva/llvm_types_test.cc index 6d75768a8040e..12fc1caefab85 100644 --- a/cpp/src/gandiva/llvm_types_test.cc +++ b/cpp/src/gandiva/llvm_types_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/llvm_types.h" +#include "gandiva/llvm_types.h" #include diff --git a/cpp/src/gandiva/lru_cache_test.cc b/cpp/src/gandiva/lru_cache_test.cc index b729803d4ba02..cc239c50e6851 100644 --- a/cpp/src/gandiva/lru_cache_test.cc +++ b/cpp/src/gandiva/lru_cache_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/lru_cache.h" +#include "gandiva/lru_cache.h" #include #include diff --git a/cpp/src/gandiva/node.h b/cpp/src/gandiva/node.h index 2d781777b1181..59b831f492a53 100644 --- a/cpp/src/gandiva/node.h +++ b/cpp/src/gandiva/node.h @@ -18,9 +18,9 @@ #include #include -#include "codegen/func_descriptor.h" -#include "codegen/literal_holder.h" -#include "codegen/node_visitor.h" +#include "gandiva/func_descriptor.h" +#include "gandiva/literal_holder.h" +#include "gandiva/node_visitor.h" #include "gandiva/arrow.h" #include "gandiva/gandiva_aliases.h" #include "gandiva/status.h" diff --git a/cpp/src/gandiva/precompiled/arithmetic_ops_test.cc b/cpp/src/gandiva/precompiled/arithmetic_ops_test.cc index fc46464f4a21d..7525a293a397e 100644 --- a/cpp/src/gandiva/precompiled/arithmetic_ops_test.cc +++ b/cpp/src/gandiva/precompiled/arithmetic_ops_test.cc @@ -13,7 +13,7 @@ // limitations under the License. #include -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/precompiled/bitmap_test.cc b/cpp/src/gandiva/precompiled/bitmap_test.cc index 1f9b395122cd4..e2f258523f7b5 100644 --- a/cpp/src/gandiva/precompiled/bitmap_test.cc +++ b/cpp/src/gandiva/precompiled/bitmap_test.cc @@ -13,7 +13,7 @@ // limitations under the License. #include -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/precompiled/epoch_time_point_test.cc b/cpp/src/gandiva/precompiled/epoch_time_point_test.cc index 825528b594bc1..91896d0f65ce0 100644 --- a/cpp/src/gandiva/precompiled/epoch_time_point_test.cc +++ b/cpp/src/gandiva/precompiled/epoch_time_point_test.cc @@ -16,7 +16,7 @@ #include #include "./epoch_time_point.h" -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/precompiled/hash_test.cc b/cpp/src/gandiva/precompiled/hash_test.cc index 7e45b19694970..747a06852cd63 100644 --- a/cpp/src/gandiva/precompiled/hash_test.cc +++ b/cpp/src/gandiva/precompiled/hash_test.cc @@ -15,7 +15,7 @@ #include #include -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/precompiled/string_ops_test.cc b/cpp/src/gandiva/precompiled/string_ops_test.cc index ddc66c90ff3b9..a50749679547c 100644 --- a/cpp/src/gandiva/precompiled/string_ops_test.cc +++ b/cpp/src/gandiva/precompiled/string_ops_test.cc @@ -13,7 +13,7 @@ // limitations under the License. #include -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/precompiled/time_test.cc b/cpp/src/gandiva/precompiled/time_test.cc index e77b2ea778446..5d396a1f2af98 100644 --- a/cpp/src/gandiva/precompiled/time_test.cc +++ b/cpp/src/gandiva/precompiled/time_test.cc @@ -15,7 +15,7 @@ #include #include -#include "precompiled/types.h" +#include "gandiva/precompiled/types.h" namespace gandiva { diff --git a/cpp/src/gandiva/projector.cc b/cpp/src/gandiva/projector.cc index 38768b1d538d7..1bdf73d1e8c58 100644 --- a/cpp/src/gandiva/projector.cc +++ b/cpp/src/gandiva/projector.cc @@ -18,10 +18,10 @@ #include #include -#include "codegen/cache.h" -#include "codegen/expr_validator.h" -#include "codegen/llvm_generator.h" -#include "codegen/projector_cache_key.h" +#include "gandiva/cache.h" +#include "gandiva/expr_validator.h" +#include "gandiva/llvm_generator.h" +#include "gandiva/projector_cache_key.h" #include "gandiva/status.h" namespace gandiva { diff --git a/cpp/src/gandiva/proto/Types.proto b/cpp/src/gandiva/proto/Types.proto new file mode 100644 index 0000000000000..6da4079776fe1 --- /dev/null +++ b/cpp/src/gandiva/proto/Types.proto @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2017-2018 Dremio Corporation + * + * Licensed 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. + */ + +syntax = "proto2"; +package types; + +option java_package = "org.apache.arrow.gandiva.ipc"; +option java_outer_classname = "GandivaTypes"; +option optimize_for = SPEED; + +enum GandivaType { + NONE = 0; // arrow::Type::NA + BOOL = 1; // arrow::Type::BOOL + UINT8 = 2; // arrow::Type::UINT8 + INT8 = 3; // arrow::Type::INT8 + UINT16 = 4; // represents arrow::Type fields in src/arrow/type.h + INT16 = 5; + UINT32 = 6; + INT32 = 7; + UINT64 = 8; + INT64 = 9; + HALF_FLOAT = 10; + FLOAT = 11; + DOUBLE = 12; + UTF8 = 13; + BINARY = 14; + FIXED_SIZE_BINARY = 15; + DATE32 = 16; + DATE64 = 17; + TIMESTAMP = 18; + TIME32 = 19; + TIME64 = 20; + INTERVAL = 21; + DECIMAL = 22; + LIST = 23; + STRUCT = 24; + UNION = 25; + DICTIONARY = 26; + MAP = 27; +} + +enum DateUnit { + DAY = 0; + MILLI = 1; +} + +enum TimeUnit { + SEC = 0; + MILLISEC = 1; + MICROSEC = 2; + NANOSEC = 3; +} + +enum SelectionVectorType { + SV_INT16 = 0; + SV_INT32 = 1; +} + +message ExtGandivaType { + optional GandivaType type = 1; + optional uint32 width = 2; // used by FIXED_SIZE_BINARY + optional int32 precision = 3; // used by DECIMAL + optional int32 scale = 4; // used by DECIMAL + optional DateUnit dateUnit = 5; // used by DATE32/DATE64 + optional TimeUnit timeUnit = 6; // used by TIME32/TIME64 + optional string timeZone = 7; // used by TIMESTAMP +} + +message Field { + // name of the field + optional string name = 1; + optional ExtGandivaType type = 2; + optional bool nullable = 3; + // for complex data types like structs, unions + repeated Field children = 4; +} + +message FieldNode { + optional Field field = 1; +} + +message FunctionNode { + optional string functionName = 1; + repeated TreeNode inArgs = 2; + optional ExtGandivaType returnType = 3; +} + +message IfNode { + optional TreeNode cond = 1; + optional TreeNode thenNode = 2; + optional TreeNode elseNode = 3; + optional ExtGandivaType returnType = 4; +} + +message AndNode { + repeated TreeNode args = 1; +} + +message OrNode { + repeated TreeNode args = 1; +} + +message NullNode { + optional ExtGandivaType type = 1; +} + +message IntNode { + optional int32 value = 1; +} + +message FloatNode { + optional float value = 1; +} + +message DoubleNode { + optional double value = 1; +} + +message BooleanNode { + optional bool value = 1; +} + +message LongNode { + optional int64 value = 1; +} + +message StringNode { + optional bytes value = 1; +} + +message BinaryNode { + optional bytes value = 1; +} + +message TreeNode { + optional FieldNode fieldNode = 1; + optional FunctionNode fnNode = 2; + + // control expressions + optional IfNode ifNode = 6; + optional AndNode andNode = 7; + optional OrNode orNode = 8; + + // literals + optional NullNode nullNode = 11; + optional IntNode intNode = 12; + optional FloatNode floatNode = 13; + optional LongNode longNode = 14; + optional BooleanNode booleanNode = 15; + optional DoubleNode doubleNode = 16; + optional StringNode stringNode = 17; + optional BinaryNode binaryNode = 18; +} + +message ExpressionRoot { + optional TreeNode root = 1; + optional Field resultType = 2; +} + +message ExpressionList { + repeated ExpressionRoot exprs = 2; +} + +message Condition { + optional TreeNode root = 1; +} + +message Schema { + repeated Field columns = 1; +} + +message GandivaDataTypes { + repeated ExtGandivaType dataType = 1; +} + +message GandivaFunctions { + repeated FunctionSignature function = 1; +} + +message FunctionSignature { + optional string name = 1; + optional ExtGandivaType returnType = 2; + repeated ExtGandivaType paramTypes = 3; +} diff --git a/cpp/src/gandiva/regex_util.cc b/cpp/src/gandiva/regex_util.cc index 41895a6cc998b..a54022d67fbf5 100644 --- a/cpp/src/gandiva/regex_util.cc +++ b/cpp/src/gandiva/regex_util.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "codegen/regex_util.h" +#include "gandiva/regex_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/selection_vector.cc b/cpp/src/gandiva/selection_vector.cc index d816b7b8d43b4..594db4dc509cc 100644 --- a/cpp/src/gandiva/selection_vector.cc +++ b/cpp/src/gandiva/selection_vector.cc @@ -18,7 +18,7 @@ #include #include -#include "codegen/selection_vector_impl.h" +#include "gandiva/selection_vector_impl.h" #include "gandiva/status.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/binary_test.cc b/cpp/src/gandiva/tests/binary_test.cc index 3636a96dd571f..fc242ee5bd7f4 100644 --- a/cpp/src/gandiva/tests/binary_test.cc +++ b/cpp/src/gandiva/tests/binary_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/boolean_expr_test.cc b/cpp/src/gandiva/tests/boolean_expr_test.cc index 66cfb110e6ada..cba360d622de4 100644 --- a/cpp/src/gandiva/tests/boolean_expr_test.cc +++ b/cpp/src/gandiva/tests/boolean_expr_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/date_time_test.cc b/cpp/src/gandiva/tests/date_time_test.cc index 76bde5adc2540..de25ef3165259 100644 --- a/cpp/src/gandiva/tests/date_time_test.cc +++ b/cpp/src/gandiva/tests/date_time_test.cc @@ -18,7 +18,7 @@ #include "arrow/memory_pool.h" #include "gandiva/projector.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/filter_test.cc b/cpp/src/gandiva/tests/filter_test.cc index 5deee9d106a5c..44984a565eebf 100644 --- a/cpp/src/gandiva/tests/filter_test.cc +++ b/cpp/src/gandiva/tests/filter_test.cc @@ -16,7 +16,7 @@ #include #include "arrow/memory_pool.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/hash_test.cc b/cpp/src/gandiva/tests/hash_test.cc index b7b4f470e0445..03af52d1f4475 100644 --- a/cpp/src/gandiva/tests/hash_test.cc +++ b/cpp/src/gandiva/tests/hash_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/if_expr_test.cc b/cpp/src/gandiva/tests/if_expr_test.cc index 1be28f203f089..4d68f4cd92520 100644 --- a/cpp/src/gandiva/tests/if_expr_test.cc +++ b/cpp/src/gandiva/tests/if_expr_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/literal_test.cc b/cpp/src/gandiva/tests/literal_test.cc index 6c2d0a9f4a404..b442c61960297 100644 --- a/cpp/src/gandiva/tests/literal_test.cc +++ b/cpp/src/gandiva/tests/literal_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/micro_benchmarks.cc b/cpp/src/gandiva/tests/micro_benchmarks.cc index b4b39b6d803bd..2eac73b44ea7a 100644 --- a/cpp/src/gandiva/tests/micro_benchmarks.cc +++ b/cpp/src/gandiva/tests/micro_benchmarks.cc @@ -17,8 +17,8 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" -#include "integ/timed_evaluate.h" +#include "gandiva/tests/test_util.h" +#include "gandiva/tests/timed_evaluate.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/projector_build_validation_test.cc b/cpp/src/gandiva/tests/projector_build_validation_test.cc index cab9c5a264685..f056a7e6de7c1 100644 --- a/cpp/src/gandiva/tests/projector_build_validation_test.cc +++ b/cpp/src/gandiva/tests/projector_build_validation_test.cc @@ -16,7 +16,7 @@ #include "arrow/memory_pool.h" #include "gandiva/projector.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/projector_test.cc b/cpp/src/gandiva/tests/projector_test.cc index d0fe6166378ed..c2b7bf1d6a087 100644 --- a/cpp/src/gandiva/tests/projector_test.cc +++ b/cpp/src/gandiva/tests/projector_test.cc @@ -16,7 +16,7 @@ #include #include "arrow/memory_pool.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/timed_evaluate.h b/cpp/src/gandiva/tests/timed_evaluate.h index e95b8bab5ed27..1923b7a0c2066 100644 --- a/cpp/src/gandiva/tests/timed_evaluate.h +++ b/cpp/src/gandiva/tests/timed_evaluate.h @@ -17,7 +17,7 @@ #include "gandiva/arrow.h" #include "gandiva/filter.h" #include "gandiva/projector.h" -#include "integ/generate_data.h" +#include "gandiva/tests/generate_data.h" #ifndef GANDIVA_TIMED_EVALUATE_H #define GANDIVA_TIMED_EVALUATE_H diff --git a/cpp/src/gandiva/tests/to_string_test.cc b/cpp/src/gandiva/tests/to_string_test.cc index a5d1260b633fd..1a8770d2ba2b2 100644 --- a/cpp/src/gandiva/tests/to_string_test.cc +++ b/cpp/src/gandiva/tests/to_string_test.cc @@ -18,7 +18,7 @@ #include "arrow/memory_pool.h" #include "gandiva/projector.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tests/utf8_test.cc b/cpp/src/gandiva/tests/utf8_test.cc index e373f0285cf3d..f537339c8a0b9 100644 --- a/cpp/src/gandiva/tests/utf8_test.cc +++ b/cpp/src/gandiva/tests/utf8_test.cc @@ -17,7 +17,7 @@ #include "gandiva/projector.h" #include "gandiva/status.h" #include "gandiva/tree_expr_builder.h" -#include "integ/test_util.h" +#include "gandiva/tests/test_util.h" namespace gandiva { diff --git a/cpp/src/gandiva/tree_expr_builder.cc b/cpp/src/gandiva/tree_expr_builder.cc index 07ad839a62df8..08c6dffbef3ea 100644 --- a/cpp/src/gandiva/tree_expr_builder.cc +++ b/cpp/src/gandiva/tree_expr_builder.cc @@ -16,7 +16,7 @@ #include -#include "codegen/node.h" +#include "gandiva/node.h" namespace gandiva { diff --git a/cpp/src/gandiva/tree_expr_test.cc b/cpp/src/gandiva/tree_expr_test.cc index 295ac0186c2d7..79c6e666219a8 100644 --- a/cpp/src/gandiva/tree_expr_test.cc +++ b/cpp/src/gandiva/tree_expr_test.cc @@ -15,11 +15,11 @@ #include "gandiva/tree_expr_builder.h" #include -#include "codegen/annotator.h" -#include "codegen/dex.h" -#include "codegen/expr_decomposer.h" -#include "codegen/function_registry.h" -#include "codegen/node.h" +#include "gandiva/annotator.h" +#include "gandiva/dex.h" +#include "gandiva/expr_decomposer.h" +#include "gandiva/function_registry.h" +#include "gandiva/node.h" #include "gandiva/function_signature.h" #include "gandiva/gandiva_aliases.h" diff --git a/java/gandiva/dev/checkstyle/suppressions.xml b/java/gandiva/dev/checkstyle/suppressions.xml index 45f7569790e39..6fd92fb5dd535 100644 --- a/java/gandiva/dev/checkstyle/suppressions.xml +++ b/java/gandiva/dev/checkstyle/suppressions.xml @@ -28,4 +28,6 @@ + + diff --git a/java/gandiva/pom.xml b/java/gandiva/pom.xml index f448f76acbc5d..812fc7691fc81 100644 --- a/java/gandiva/pom.xml +++ b/java/gandiva/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.dremio.arrow.gandiva + org.apache.arrow.gandiva gandiva-java 0.1-SNAPSHOT jar @@ -33,12 +33,6 @@ true ../cpp/debug - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - org.apache.arrow @@ -124,13 +118,13 @@ - ${gandiva.cpp.build.dir}/src/jni + ${gandiva.cpp.build.dir}/debug **/libgandiva_jni.* - ${gandiva.cpp.build.dir}/src/codegen + ${gandiva.cpp.build.dir}/debug **/libgandiva_helpers.* @@ -158,7 +152,7 @@ com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} - ../proto + ../../cpp/src/gandiva/proto @@ -214,18 +208,6 @@ false - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - - false - -