Skip to content
Open
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
17 changes: 14 additions & 3 deletions datafusion/functions/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,22 @@ macro_rules! downcast_arg {
/// $NAME: the name of the function
/// $UNARY_FUNC: the unary function to apply to the argument
/// $OUTPUT_ORDERING: the output ordering calculation method of the function
/// $STRICT: whether the function returns NULL when any argument is NULL
/// $GET_DOC: the function to get the documentation of the UDF
macro_rules! make_math_unary_udf {
($UDF:ident, $NAME:ident, $UNARY_FUNC:ident, $OUTPUT_ORDERING:expr, $EVALUATE_BOUNDS:expr, $GET_DOC:expr) => {
($UDF:ident, $NAME:ident, $UNARY_FUNC:ident, $OUTPUT_ORDERING:expr, $EVALUATE_BOUNDS:expr, $STRICT:expr, $GET_DOC:expr) => {
make_math_unary_udf!(
$UDF,
$NAME,
$UNARY_FUNC,
$OUTPUT_ORDERING,
$EVALUATE_BOUNDS,
$STRICT,
$GET_DOC,
None::<fn(f64) -> Result<()>>
);
};
($UDF:ident, $NAME:ident, $UNARY_FUNC:ident, $OUTPUT_ORDERING:expr, $EVALUATE_BOUNDS:expr, $GET_DOC:expr, $VALIDATOR:expr) => {
($UDF:ident, $NAME:ident, $UNARY_FUNC:ident, $OUTPUT_ORDERING:expr, $EVALUATE_BOUNDS:expr, $STRICT:expr, $GET_DOC:expr, $VALIDATOR:expr) => {
$crate::make_udf_function!($NAME::$UDF, $NAME);

mod $NAME {
Expand Down Expand Up @@ -273,6 +275,10 @@ macro_rules! make_math_unary_udf {
}
}

fn is_strict(&self) -> bool {
$STRICT
}

fn output_ordering(
&self,
input: &[ExprProperties],
Expand Down Expand Up @@ -354,9 +360,10 @@ macro_rules! make_math_unary_udf {
/// $NAME: the name of the function
/// $BINARY_FUNC: the binary function to apply to the argument
/// $OUTPUT_ORDERING: the output ordering calculation method of the function
/// $STRICT: whether the function returns NULL when any argument is NULL
/// $GET_DOC: the function to get the documentation of the UDF
macro_rules! make_math_binary_udf {
($UDF:ident, $NAME:ident, $BINARY_FUNC:ident, $OUTPUT_ORDERING:expr, $GET_DOC:expr) => {
($UDF:ident, $NAME:ident, $BINARY_FUNC:ident, $OUTPUT_ORDERING:expr, $STRICT:expr, $GET_DOC:expr) => {
$crate::make_udf_function!($NAME::$UDF, $NAME);

mod $NAME {
Expand Down Expand Up @@ -414,6 +421,10 @@ macro_rules! make_math_binary_udf {
}
}

fn is_strict(&self) -> bool {
$STRICT
}

fn output_ordering(
&self,
input: &[ExprProperties],
Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/ceil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ impl ScalarUDFImpl for CeilFunc {
}
}

fn is_strict(&self) -> bool {
true
}

fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
let arg = &args.args[0];

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/cot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ impl ScalarUDFImpl for CotFunc {
}
}

fn is_strict(&self) -> bool {
true
}

fn documentation(&self) -> Option<&Documentation> {
self.doc()
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/factorial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ impl ScalarUDFImpl for FactorialFunc {
Ok(Int64)
}

fn is_strict(&self) -> bool {
true
}

fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
let [arg] = take_function_args(self.name(), args.args)?;

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/floor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ impl ScalarUDFImpl for FloorFunc {
}
}

fn is_strict(&self) -> bool {
true
}

fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
let arg = &args.args[0];

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/gcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ impl ScalarUDFImpl for GcdFunc {
Ok(arg_types[0].clone())
}

fn is_strict(&self) -> bool {
true
}

fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
let [arg1, arg2] = take_function_args(self.name(), arg_types)?;

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/iszero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ impl ScalarUDFImpl for IsZeroFunc {
Ok(Boolean)
}

fn is_strict(&self) -> bool {
true
}

fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue> {
let [arg] = take_function_args(self.name(), args.args)?;

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/lcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ impl ScalarUDFImpl for LcmFunc {
Ok(arg_types[0].clone())
}

fn is_strict(&self) -> bool {
true
}

fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
let [arg1, arg2] = take_function_args(self.name(), arg_types)?;

Expand Down
4 changes: 4 additions & 0 deletions datafusion/functions/src/math/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ impl ScalarUDFImpl for LogFunc {
}
}

fn is_strict(&self) -> bool {
true
}

fn output_ordering(&self, input: &[ExprProperties]) -> Result<SortProperties> {
let (base_sort_properties, num_sort_properties) = if input.len() == 1 {
// log(x) defaults to log(10, x)
Expand Down
Loading
Loading