diff --git a/.github/workflows/linux-build-base.yml b/.github/workflows/linux-build-base.yml index 90c25d7ebb7c..80bc40c98bdf 100644 --- a/.github/workflows/linux-build-base.yml +++ b/.github/workflows/linux-build-base.yml @@ -39,6 +39,7 @@ jobs: GTest_SOURCE: BUNDLED simdjson_SOURCE: BUNDLED xsimd_SOURCE: BUNDLED + geos_SOURCE: BUNDLED CUDA_VERSION: "12.4" USE_CLANG: "${{ inputs.use-clang && 'true' || 'false' }}" steps: @@ -88,6 +89,7 @@ jobs: "-DVELOX_ENABLE_BENCHMARKS=ON" "-DVELOX_ENABLE_EXAMPLES=ON" "-DVELOX_ENABLE_ARROW=ON" + "-DVELOX_ENABLE_GEO=ON" "-DVELOX_ENABLE_PARQUET=ON" "-DVELOX_ENABLE_HDFS=ON" "-DVELOX_ENABLE_S3=ON" diff --git a/CMake/resolve_dependency_modules/README.md b/CMake/resolve_dependency_modules/README.md index f764509f00b7..b8e17cfde8e2 100644 --- a/CMake/resolve_dependency_modules/README.md +++ b/CMake/resolve_dependency_modules/README.md @@ -41,6 +41,7 @@ by Velox. See details on bundling below. | DuckDB (testing) | 0.8.1 | Yes | | cpr (testing) | 1.10.15 | Yes | | arrow | 15.0.0 | Yes | +| geos | 3.13.0 | Yes | # Bundled Dependency Management This module provides a dependency management system that allows us to automatically fetch and build dependencies from source if needed. diff --git a/CMake/resolve_dependency_modules/geos.cmake b/CMake/resolve_dependency_modules/geos.cmake new file mode 100644 index 000000000000..3fa073ebeee9 --- /dev/null +++ b/CMake/resolve_dependency_modules/geos.cmake @@ -0,0 +1,30 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# 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. +include_guard(GLOBAL) + +# GEOS Configuration +set(VELOX_GEOS_BUILD_VERSION 3.13.0) +set(VELOX_GEOS_BUILD_SHA256_CHECKSUM + 47ec83ff334d672b9e4426695f15da6e6368244214971fabf386ff8ef6df39e4) +string(CONCAT VELOX_GEOS_SOURCE_URL "https://download.osgeo.org/geos/" + "geos-${VELOX_GEOS_BUILD_VERSION}.tar.bz2") + +velox_resolve_dependency_url(GEOS) + +FetchContent_Declare( + geos + URL ${VELOX_GEOS_SOURCE_URL} + URL_HASH ${VELOX_GEOS_BUILD_SHA256_CHECKSUM}) +set(BUILD_SHARED_LIBS ${VELOX_BUILD_SHARED}) +FetchContent_MakeAvailable(geos) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb781253f1ca..578729a5b4f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,7 @@ option(VELOX_ENABLE_ABFS "Build Abfs Connector" OFF) option(VELOX_ENABLE_HDFS "Build Hdfs Connector" OFF) option(VELOX_ENABLE_PARQUET "Enable Parquet support" ON) option(VELOX_ENABLE_ARROW "Enable Arrow support" OFF) +option(VELOX_ENABLE_GEO "Enable Geospatial support" OFF) option(VELOX_ENABLE_REMOTE_FUNCTIONS "Enable remote function support" OFF) option(VELOX_ENABLE_CCACHE "Use ccache if installed." ON) @@ -626,4 +627,9 @@ if(VELOX_ENABLE_ARROW) velox_resolve_dependency(Arrow) endif() +if(VELOX_ENABLE_GEO) + velox_set_source(geos) + velox_resolve_dependency(geos) +endif() + add_subdirectory(velox) diff --git a/scripts/setup-centos9.sh b/scripts/setup-centos9.sh index 6168c51488a1..3773a0adef40 100755 --- a/scripts/setup-centos9.sh +++ b/scripts/setup-centos9.sh @@ -36,6 +36,7 @@ export CFLAGS=${CXXFLAGS//"-std=c++17"/} # Used by LZO. CMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}" VELOX_BUILD_SHARED=${VELOX_BUILD_SHARED:-"OFF"} #Build folly and gflags shared for use in libvelox.so. BUILD_DUCKDB="${BUILD_DUCKDB:-true}" +BUILD_GEOS="${BUILD_GEOS:-true}" USE_CLANG="${USE_CLANG:-false}" export INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"} DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download} @@ -48,6 +49,7 @@ THRIFT_VERSION="v0.16.0" ARROW_VERSION="15.0.0" STEMMER_VERSION="2.2.0" DUCKDB_VERSION="v0.8.1" +GEOS_VERSION="3.13.0" function dnf_install { dnf install -y -q --setopt=install_weak_deps=False "$@" @@ -235,6 +237,13 @@ function install_cuda { dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed } +function install_geos { + if [[ "$BUILD_GEOS" == "true" ]]; then + wget_and_untar https://github.com/libgeos/geos/archive/${GEOS_VERSION}.tar.gz geos + cmake_install_dir geos -DBUILD_TESTING=OFF + fi +} + function install_velox_deps { run_and_time install_velox_deps_from_dnf run_and_time install_conda @@ -254,6 +263,7 @@ function install_velox_deps { run_and_time install_stemmer run_and_time install_thrift run_and_time install_arrow + run_and_time install_geos } (return 2> /dev/null) && return # If script was sourced, don't run commands. diff --git a/scripts/setup-macos.sh b/scripts/setup-macos.sh index d38f37acc5ef..5c9089aab002 100755 --- a/scripts/setup-macos.sh +++ b/scripts/setup-macos.sh @@ -39,6 +39,7 @@ export OS_CXXFLAGS=" -isystem $(brew --prefix)/include " NPROC=${BUILD_THREADS:-$(getconf _NPROCESSORS_ONLN)} BUILD_DUCKDB="${BUILD_DUCKDB:-true}" +BUILD_GEOS="${BUILD_GEOS:-true}" VELOX_BUILD_SHARED=${VELOX_BUILD_SHARED:-"OFF"} #Build folly shared for use in libvelox.so. DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)} MACOS_VELOX_DEPS="bison flex gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 snappy xz zstd" @@ -48,6 +49,7 @@ FMT_VERSION="10.1.1" BOOST_VERSION="boost-1.84.0" STEMMER_VERSION="2.2.0" DUCKDB_VERSION="v0.8.1" +GEOS_VERSION="3.13.0" function update_brew { DEFAULT_BREW_PATH=/usr/local/bin/brew @@ -174,6 +176,13 @@ function install_stemmer { ) } +function install_geos { + if [[ "$BUILD_GEOS" == "true" ]]; then + wget_and_untar https://github.com/libgeos/geos/archive/${GEOS_VERSION}.tar.gz geos + cmake_install_dir geos -DBUILD_TESTING=OFF + fi +} + function install_velox_deps { run_and_time install_velox_deps_from_brew run_and_time install_ranges_v3 @@ -188,6 +197,7 @@ function install_velox_deps { run_and_time install_fbthrift run_and_time install_duckdb run_and_time install_stemmer + run_and_time install_geos } (return 2> /dev/null) && return # If script was sourced, don't run commands. diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 3d3a7898aeac..deba1ffdd7a9 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -36,6 +36,7 @@ COMPILER_FLAGS=$(get_cxx_flags) export COMPILER_FLAGS NPROC=${BUILD_THREADS:-$(getconf _NPROCESSORS_ONLN)} BUILD_DUCKDB="${BUILD_DUCKDB:-true}" +BUILD_GEOS="${BUILD_GEOS:-true}" export CMAKE_BUILD_TYPE=Release VELOX_BUILD_SHARED=${VELOX_BUILD_SHARED:-"OFF"} #Build folly shared for use in libvelox.so. SUDO="${SUDO:-"sudo --preserve-env"}" @@ -80,6 +81,7 @@ THRIFT_VERSION="v0.16.0" ARROW_VERSION="15.0.0" STEMMER_VERSION="2.2.0" DUCKDB_VERSION="v0.8.1" +GEOS_VERSION="3.13.0" # Install packages required for build. function install_build_prerequisites { @@ -294,6 +296,13 @@ function install_cuda { $SUDO apt install -y cuda-nvcc-$dashed cuda-cudart-dev-$dashed cuda-nvrtc-dev-$dashed cuda-driver-dev-$dashed } +function install_geos { + if [[ "$BUILD_GEOS" == "true" ]]; then + wget_and_untar https://github.com/libgeos/geos/archive/${GEOS_VERSION}.tar.gz geos + cmake_install_dir geos -DBUILD_TESTING=OFF + fi +} + function install_velox_deps { run_and_time install_velox_deps_from_apt run_and_time install_fmt @@ -309,6 +318,7 @@ function install_velox_deps { run_and_time install_stemmer run_and_time install_thrift run_and_time install_arrow + run_and_time install_geos } function install_apt_deps {