chore: little cleanup to reuse the `NUMERICS` list
parent
2cbaf9cffa
commit
fa428560b4
|
@ -11,7 +11,7 @@ use std::sync::Arc;
|
|||
|
||||
/// A list of the numeric types supported by InfluxQL that can be be used
|
||||
/// as input to user-defined aggregate functions.
|
||||
static NUMERICS: &[DataType] = &[DataType::Int64, DataType::UInt64, DataType::Float64];
|
||||
pub(crate) static NUMERICS: &[DataType] = &[DataType::Int64, DataType::UInt64, DataType::Float64];
|
||||
|
||||
/// Name of the `MOVING_AVERAGE` user-defined aggregate function.
|
||||
pub(crate) const MOVING_AVERAGE_NAME: &str = "moving_average";
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//! rewritten at a later stage of planning, with more context available.
|
||||
|
||||
use crate::plan::error;
|
||||
use crate::plan::udaf::NUMERICS;
|
||||
use crate::plan::util_copy::find_exprs_in_exprs;
|
||||
use arrow::datatypes::DataType;
|
||||
use datafusion::logical_expr::{
|
||||
|
@ -57,12 +58,11 @@ static MOVING_AVERAGE: Lazy<Arc<ScalarUDF>> = Lazy::new(|| {
|
|||
Arc::new(ScalarUDF::new(
|
||||
MOVING_AVERAGE_UDF_NAME,
|
||||
&Signature::one_of(
|
||||
vec![
|
||||
TypeSignature::Exact(vec![DataType::Float64, DataType::Int64]),
|
||||
TypeSignature::Exact(vec![DataType::Int64, DataType::Int64]),
|
||||
TypeSignature::Exact(vec![DataType::UInt64, DataType::Int64]),
|
||||
],
|
||||
Volatility::Volatile,
|
||||
NUMERICS
|
||||
.iter()
|
||||
.map(|dt| TypeSignature::Exact(vec![dt.clone(), DataType::Int64]))
|
||||
.collect(),
|
||||
Volatility::Immutable,
|
||||
),
|
||||
&return_type_fn,
|
||||
&stand_in_impl(MOVING_AVERAGE_UDF_NAME),
|
||||
|
@ -82,12 +82,11 @@ static DIFFERENCE: Lazy<Arc<ScalarUDF>> = Lazy::new(|| {
|
|||
Arc::new(ScalarUDF::new(
|
||||
DIFFERENCE_UDF_NAME,
|
||||
&Signature::one_of(
|
||||
vec![
|
||||
TypeSignature::Exact(vec![DataType::Float64]),
|
||||
TypeSignature::Exact(vec![DataType::Int64]),
|
||||
TypeSignature::Exact(vec![DataType::UInt64]),
|
||||
],
|
||||
Volatility::Volatile,
|
||||
NUMERICS
|
||||
.iter()
|
||||
.map(|dt| TypeSignature::Exact(vec![dt.clone()]))
|
||||
.collect(),
|
||||
Volatility::Immutable,
|
||||
),
|
||||
&return_type_fn,
|
||||
&stand_in_impl(DIFFERENCE_UDF_NAME),
|
||||
|
@ -107,12 +106,11 @@ static NON_NEGATIVE_DIFFERENCE: Lazy<Arc<ScalarUDF>> = Lazy::new(|| {
|
|||
Arc::new(ScalarUDF::new(
|
||||
NON_NEGATIVE_DIFFERENCE_UDF_NAME,
|
||||
&Signature::one_of(
|
||||
vec![
|
||||
TypeSignature::Exact(vec![DataType::Float64]),
|
||||
TypeSignature::Exact(vec![DataType::Int64]),
|
||||
TypeSignature::Exact(vec![DataType::UInt64]),
|
||||
],
|
||||
Volatility::Volatile,
|
||||
NUMERICS
|
||||
.iter()
|
||||
.map(|dt| TypeSignature::Exact(vec![dt.clone()]))
|
||||
.collect(),
|
||||
Volatility::Immutable,
|
||||
),
|
||||
&return_type_fn,
|
||||
&stand_in_impl(NON_NEGATIVE_DIFFERENCE_UDF_NAME),
|
||||
|
|
Loading…
Reference in New Issue