Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add GEOS library as an optional dependency #12243

Closed
wants to merge 1 commit into from
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
2 changes: 2 additions & 0 deletions .github/workflows/linux-build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions CMake/resolve_dependency_modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 31 additions & 0 deletions CMake/resolve_dependency_modules/geos.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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)
unset(BUILD_SHARED_LIBS)
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add VELOX_ENABLE_GEO to the adapters build : https://github.com/facebookincubator/velox/blob/main/.github/workflows/linux-build-base.yml#L87 ?
If it doesnt get exercised by default, we need a signal these changes pass CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

option(VELOX_ENABLE_REMOTE_FUNCTIONS "Enable remote function support" OFF)
option(VELOX_ENABLE_CCACHE "Use ccache if installed." ON)

Expand Down Expand Up @@ -628,4 +629,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)
10 changes: 10 additions & 0 deletions scripts/setup-centos9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 "$@"
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"}"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Loading