Skip to content

Apache DataFusion SQL Query Engine

Fix build with `--no-default-features` (#1219)

Andrew Lamb91b5469c2061
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 0fd42a642c..b475775e96 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -64,6 +64,12 @@ jobs:
env:
CARGO_HOME: "/github/home/.cargo"
CARGO_TARGET_DIR: "/github/home/target"
+ - name: Check DataFusion Build without default features
+ run: |
+ cargo check --no-default-features -p datafusion
+ env:
+ CARGO_HOME: "/github/home/.cargo"
+ CARGO_TARGET_DIR: "/github/home/target"
# test the crate
linux-test:
diff --git a/datafusion/Cargo.toml b/datafusion/Cargo.toml
index e05bc0702b..793262a031 100644
--- a/datafusion/Cargo.toml
+++ b/datafusion/Cargo.toml
@@ -41,7 +41,7 @@ path = "src/lib.rs"
default = ["crypto_expressions", "regex_expressions", "unicode_expressions"]
simd = ["arrow/simd"]
crypto_expressions = ["md-5", "sha2", "blake2", "blake3"]
-regex_expressions = ["regex", "lazy_static"]
+regex_expressions = ["regex"]
unicode_expressions = ["unicode-segmentation"]
# Used for testing ONLY: causes all values to hash to the same value (test for collisions)
force_hash_collisions = []
@@ -70,7 +70,7 @@ blake3 = { version = "1.0", optional = true }
ordered-float = "2.0"
unicode-segmentation = { version = "^1.7.1", optional = true }
regex = { version = "^1.4.3", optional = true }
-lazy_static = { version = "^1.4.0", optional = true }
+lazy_static = { version = "^1.4.0" }
smallvec = { version = "1.6", features = ["union"] }
rand = "0.8"
avro-rs = { version = "0.13", features = ["snappy"], optional = true }
diff --git a/datafusion/src/lib.rs b/datafusion/src/lib.rs
index fa140cee38..2159864d10 100644
--- a/datafusion/src/lib.rs
+++ b/datafusion/src/lib.rs
@@ -236,9 +236,5 @@ pub(crate) mod field_util;
pub mod test;
pub mod test_util;
-#[macro_use]
-#[cfg(feature = "regex_expressions")]
-extern crate lazy_static;
-
#[cfg(doctest)]
doc_comment::doctest!("../../README.md", readme_example_test);
diff --git a/datafusion/src/physical_plan/file_format/mod.rs b/datafusion/src/physical_plan/file_format/mod.rs
index d460e9830f..3ad8ffefe4 100644
--- a/datafusion/src/physical_plan/file_format/mod.rs
+++ b/datafusion/src/physical_plan/file_format/mod.rs
@@ -39,6 +39,7 @@ use crate::{
datasource::{object_store::ObjectStore, PartitionedFile},
scalar::ScalarValue,
};
+use lazy_static::lazy_static;
use std::{
collections::HashMap,
fmt::{Display, Formatter, Result as FmtResult},
diff --git a/datafusion/src/physical_plan/regex_expressions.rs b/datafusion/src/physical_plan/regex_expressions.rs
index 4a10d0d95b..e4d1f2e007 100644
--- a/datafusion/src/physical_plan/regex_expressions.rs
+++ b/datafusion/src/physical_plan/regex_expressions.rs
@@ -28,6 +28,7 @@ use crate::error::{DataFusionError, Result};
use arrow::array::{ArrayRef, GenericStringArray, StringOffsetSizeTrait};
use arrow::compute;
use hashbrown::HashMap;
+use lazy_static::lazy_static;
use regex::Regex;
macro_rules! downcast_string_arg {