-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Run cargo-fmt on datafusion-functions/core
#9367
Changes from 1 commit
fa643b4
8e845be
8dd8d5a
20401fa
dd081d2
293a1a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,11 @@ use log::debug; | |
#[macro_use] | ||
pub mod macros; | ||
|
||
make_package!(core, "core_expressions", "Core datafusion expressions"); | ||
/// Core datafusion expressions | ||
/// Enabled via feature flag `core_expressions` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual change. If this PR is merged, I will make follow on PR(s) to apply the same treatment to the other modules in I did only one initially to keep the size of the PR down |
||
#[cfg(feature = "core_expressions")] | ||
pub mod core; | ||
make_stub_package!(core, "core_expressions"); | ||
|
||
make_package!( | ||
encoding, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,30 @@ macro_rules! make_package { | |
}; | ||
} | ||
|
||
/// Macro creates a sub module if the feature is not enabled | ||
/// | ||
/// The rationale for providing stub functions is to help users to configure datafusion | ||
/// properly (so they get an error telling them why a function is not available) | ||
/// instead of getting a cryptic "no function found" message at runtime. | ||
|
||
macro_rules! make_stub_package { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is part of the Once I port over the other modules to use this pattern, I will remove the |
||
($name:ident, $feature:literal) => { | ||
#[cfg(not(feature = $feature))] | ||
#[doc = concat!("Disabled. Enable via feature flag `", $feature, "`")] | ||
pub mod $name { | ||
use datafusion_expr::ScalarUDF; | ||
use log::debug; | ||
use std::sync::Arc; | ||
|
||
/// Returns an empty list of functions when the feature is not enabled | ||
pub fn functions() -> Vec<Arc<ScalarUDF>> { | ||
debug!("{} functions disabled", stringify!($name)); | ||
vec![] | ||
} | ||
} | ||
}; | ||
} | ||
|
||
/// Invokes a function on each element of an array and returns the result as a new array | ||
/// | ||
/// $ARG: ArrayRef | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file are entirely due to
cargo-fmt
being run now