Skip to content

Commit

Permalink
Add CI compile checks for feature flags in datafusion-functions (apac…
Browse files Browse the repository at this point in the history
…he#9772)

* Add CI checks for feature flags

* Fix builds

* Move function benchmark to datafusion-functions crate

* Less aggressive ci checks

* Improve doc

* Fix compilation of datafusion-array

* toml format

* Update datafusion/functions-array/benches/array_expression.rs
  • Loading branch information
alamb authored Mar 30, 2024
1 parent 078aeb6 commit d896000
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 21 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,42 +65,73 @@ jobs:
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache-benchmark-${{ hashFiles('datafusion/**/Cargo.toml', 'benchmarks/Cargo.toml', 'datafusion-cli/Cargo.toml') }}

- name: Check workspace without default features
- name: Check datafusion without default features
# Some of the test binaries require the parquet feature still
#run: cargo check --all-targets --no-default-features -p datafusion
run: cargo check --no-default-features -p datafusion

- name: Check datafusion-common without default features
run: cargo check --tests --no-default-features -p datafusion-common
run: cargo check --all-targets --no-default-features -p datafusion-common

- name: Check datafusion-functions
run: cargo check --all-targets --no-default-features -p datafusion-functions

- name: Check workspace in debug mode
run: cargo check

- name: Check workspace with all features
- name: Check workspace with avro,json features
run: cargo check --workspace --benches --features avro,json

- name: Check Cargo.lock for datafusion-cli
run: |
# If this test fails, try running `cargo update` in the `datafusion-cli` directory
# and check in the updated Cargo.lock file.
cargo check --manifest-path datafusion-cli/Cargo.toml --locked
# Ensure that the datafusion crate can be built with only a subset of the function
# packages enabled.
- name: Check function packages (array_expressions)
- name: Check datafusion (array_expressions)
run: cargo check --no-default-features --features=array_expressions -p datafusion

- name: Check function packages (datetime_expressions)
- name: Check datafusion (crypto)
run: cargo check --no-default-features --features=crypto_expressions -p datafusion

- name: Check datafusion (datetime_expressions)
run: cargo check --no-default-features --features=datetime_expressions -p datafusion

- name: Check function packages (encoding_expressions)
- name: Check datafusion (encoding_expressions)
run: cargo check --no-default-features --features=encoding_expressions -p datafusion

- name: Check function packages (math_expressions)
- name: Check datafusion (math_expressions)
run: cargo check --no-default-features --features=math_expressions -p datafusion

- name: Check function packages (regex_expressions)
- name: Check datafusion (regex_expressions)
run: cargo check --no-default-features --features=regex_expressions -p datafusion

- name: Check Cargo.lock for datafusion-cli
run: |
# If this test fails, try running `cargo update` in the `datafusion-cli` directory
# and check in the updated Cargo.lock file.
cargo check --manifest-path datafusion-cli/Cargo.toml --locked
- name: Check datafusion (string_expressions)
run: cargo check --no-default-features --features=string_expressions -p datafusion

# Ensure that the datafusion-functions crate can be built with only a subset of the function
# packages enabled.
- name: Check datafusion-functions (crypto)
run: cargo check --all-targets --no-default-features --features=crypto_expressions -p datafusion-functions

- name: Check datafusion-functions (datetime_expressions)
run: cargo check --all-targets --no-default-features --features=datetime_expressions -p datafusion-functions

- name: Check datafusion-functions (encoding_expressions)
run: cargo check --all-targets --no-default-features --features=encoding_expressions -p datafusion-functions

- name: Check datafusion-functions (math_expressions)
run: cargo check --all-targets --no-default-features --features=math_expressions -p datafusion-functions

- name: Check datafusion-functions (regex_expressions)
run: cargo check --all-targets --no-default-features --features=regex_expressions -p datafusion-functions

- name: Check datafusion-functions (string_expressions)
run: cargo check --all-targets --no-default-features --features=string_expressions -p datafusion-functions

# test the crate
# Run tests
linux-test:
name: cargo test (amd64)
needs: [ linux-build-lib ]
Expand Down
7 changes: 3 additions & 4 deletions datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ default = [
"datetime_expressions",
"encoding_expressions",
"regex_expressions",
"string_expressions",
"unicode_expressions",
"compression",
"parquet",
Expand All @@ -66,6 +67,7 @@ regex_expressions = [
"datafusion-functions/regex_expressions",
]
serde = ["arrow-schema/serde"]
string_expressions = ["datafusion-functions/string_expressions"]
unicode_expressions = [
"datafusion-physical-expr/unicode_expressions",
"datafusion-optimizer/unicode_expressions",
Expand Down Expand Up @@ -188,6 +190,7 @@ name = "physical_plan"
[[bench]]
harness = false
name = "parquet_query_sql"
required-features = ["parquet"]

[[bench]]
harness = false
Expand All @@ -204,7 +207,3 @@ name = "sort"
[[bench]]
harness = false
name = "topk_aggregate"

[[bench]]
harness = false
name = "array_expression"
7 changes: 7 additions & 0 deletions datafusion/functions-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ datafusion-functions = { workspace = true }
itertools = { version = "0.12", features = ["use_std"] }
log = { workspace = true }
paste = "1.0.14"

[dev-dependencies]
criterion = { version = "0.5", features = ["async_tokio"] }

[[bench]]
harness = false
name = "array_expression"
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
#[macro_use]
extern crate criterion;
extern crate arrow;
extern crate datafusion;

mod data_utils;
use crate::criterion::Criterion;
use datafusion::functions_array::expr_fn::{array_replace_all, make_array};
use datafusion_expr::lit;
use datafusion_functions_array::expr_fn::{array_replace_all, make_array};

fn criterion_benchmark(c: &mut Criterion) {
// Construct large arrays for benchmarking
Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,19 @@ tokio = { workspace = true, features = ["macros", "rt", "sync"] }
[[bench]]
harness = false
name = "to_timestamp"
required-features = ["datetime_expressions"]

[[bench]]
harness = false
name = "regx"
required-features = ["regex_expressions"]

[[bench]]
harness = false
name = "make_date"
required-features = ["datetime_expressions"]

[[bench]]
harness = false
name = "to_char"
required-features = ["datetime_expressions"]

0 comments on commit d896000

Please sign in to comment.