blob: c04044847a61292dee718a27806fb811557b2c7f [file]
# 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.
[package]
name = "datafusion-jni"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
# cdylib JNI artifact loaded by the JVM, not a crates.io library.
publish = false
[lib]
# `rlib` alongside `cdylib` so `cargo test` has a Rust-level harness for
# native-only invariants (the error-classification tests now live in
# `datafusion-jni-common`). The `cdylib` is still the artifact the JVM loads.
crate-type = ["cdylib", "rlib"]
[features]
# Object-store backends are on by default (per PR #73) so `make test` exercises
# them; downstream builds that strip a feature get a clear runtime error if a
# caller tries to register an unsupported backend. Substrait is opt-in: the
# transitive `substrait` crate's build script invokes its own `prost_build`,
# and our `build.rs`'s vendored `PROTOC` only applies to our own compilation,
# so making substrait default-on would force `protoc` on every clean build.
default = [
"object-store-aws",
"object-store-gcp",
"object-store-http",
"spark",
]
object-store-aws = ["object_store/aws"]
object-store-gcp = ["object_store/gcp"]
object-store-http = ["object_store/http"]
# Pulls in `datafusion-substrait` so `SessionContext.fromSubstrait(byte[])` can
# decode and execute Substrait plans. Enable explicitly:
#
# cargo build --features substrait # needs protoc on PATH
# cargo build --features substrait,protoc # vendor protoc via cmake
#
# The JNI handler throws a clear "feature not enabled" error from the JVM if
# invoked in a build that compiled the feature off, so the Java surface is
# unchanged either way.
substrait = ["dep:datafusion-substrait"]
# Forwards to `datafusion-substrait/protoc`, which uses `protobuf-src` (compiles
# protoc from source via cmake) so the substrait dependency stack does not
# require a system `protoc`. Useful for hermetic builds; requires cmake.
protoc = ["datafusion-substrait?/protoc"]
# Pulls in `tokio-metrics` so `SessionContext.runtimeStats()` returns real
# numbers from the underlying Tokio runtime. Off by default because
# `tokio-metrics` only compiles when `--cfg tokio_unstable` is set, and we
# don't want to force that flag onto every build. Enable explicitly:
#
# RUSTFLAGS="--cfg tokio_unstable" cargo build --features runtime-metrics
#
# The JNI handler returns a clear "feature not enabled" error from the JVM if
# invoked in a build that compiled the feature off, so the Java surface is
# unchanged either way.
runtime-metrics = ["dep:tokio-metrics"]
# Apache Spark-compatible functions, registered when a caller builds a
# context with `SessionContextBuilder.withSparkFunctions()`. On by default so
# Java callers don't have to think about features; builds that strip it get a
# clear runtime error from the JVM if the flag is requested.
spark = ["dep:datafusion-spark"]
[dependencies]
arrow = { workspace = true }
async-trait = { workspace = true }
datafusion = { workspace = true, features = ["avro"] }
# Shared JNI plumbing (error->exception mapping, runtime singleton,
# StreamingReader). `avro` keeps the classifier's AvroError->IoException arm
# in sync with the `avro` feature on `datafusion` above.
datafusion-jni-common = { path = "../native-common", features = ["avro"] }
datafusion-proto = { workspace = true }
# Apache Spark-compatible functions + expression planners. Optional and
# gated behind the `spark` feature (in the default set). The `core` feature
# of the crate is what exposes `SessionStateBuilderSpark`.
datafusion-spark = { workspace = true, features = ["core"], optional = true }
datafusion-substrait = { workspace = true, optional = true }
futures = { workspace = true }
jni = { workspace = true }
object_store = { workspace = true }
prost = { workspace = true }
tokio = { workspace = true }
tokio-metrics = { workspace = true, optional = true }
url = { workspace = true }
[build-dependencies]
prost-build = { workspace = true }
protoc-bin-vendored = { workspace = true }