Skip to content

Commit

Permalink
rename to nullary
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
  • Loading branch information
jayzhan211 committed Nov 12, 2024
1 parent d0f27c6 commit 825e714
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions datafusion/expr-common/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub enum TypeSignature {
/// Dictionary with string value type is also handled.
String(usize),
/// Zero argument
ZeroArg,
NullAry,
}

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash)]
Expand Down Expand Up @@ -192,7 +192,7 @@ impl std::fmt::Display for ArrayFunctionSignature {
impl TypeSignature {
pub fn to_string_repr(&self) -> Vec<String> {
match self {
TypeSignature::ZeroArg => {
TypeSignature::NullAry => {
vec!["ZeroArg()".to_string()]
}
TypeSignature::Variadic(types) => {
Expand Down Expand Up @@ -248,7 +248,7 @@ impl TypeSignature {
pub fn supports_zero_argument(&self) -> bool {
match &self {
TypeSignature::Exact(vec) => vec.is_empty(),
TypeSignature::ZeroArg => true,
TypeSignature::NullAry => true,
TypeSignature::OneOf(types) => types
.iter()
.any(|type_sig| type_sig.supports_zero_argument()),
Expand Down Expand Up @@ -291,7 +291,7 @@ impl TypeSignature {
.collect(),
// TODO: Implement for other types
TypeSignature::Any(_)
| TypeSignature::ZeroArg
| TypeSignature::NullAry
| TypeSignature::VariadicAny
| TypeSignature::ArraySignature(_)
| TypeSignature::UserDefined => vec![],
Expand Down Expand Up @@ -414,7 +414,7 @@ impl Signature {

pub fn zero_arg(volatility: Volatility) -> Self {
Signature {
type_signature: TypeSignature::ZeroArg,
type_signature: TypeSignature::NullAry,
volatility,
}
}
Expand Down Expand Up @@ -491,10 +491,10 @@ mod tests {
TypeSignature::Exact(vec![]),
TypeSignature::OneOf(vec![
TypeSignature::Exact(vec![DataType::Int8]),
TypeSignature::ZeroArg,
TypeSignature::NullAry,
TypeSignature::Uniform(1, vec![DataType::Int8]),
]),
TypeSignature::ZeroArg,
TypeSignature::NullAry,
];

for case in positive_cases {
Expand Down
4 changes: 2 additions & 2 deletions datafusion/expr/src/type_coercion/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn is_well_supported_signature(type_signature: &TypeSignature) -> bool {
| TypeSignature::String(_)
| TypeSignature::Coercible(_)
| TypeSignature::Any(_)
| TypeSignature::ZeroArg
| TypeSignature::NullAry
)
}

Expand Down Expand Up @@ -618,7 +618,7 @@ fn get_valid_types(
}
}
},
TypeSignature::ZeroArg => {
TypeSignature::NullAry => {
if !current_types.is_empty() {
return plan_err!(
"The function expected zero argument but received {}",
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Count {
pub fn new() -> Self {
Self {
signature: Signature::one_of(
vec![TypeSignature::VariadicAny, TypeSignature::ZeroArg],
vec![TypeSignature::VariadicAny, TypeSignature::NullAry],
Volatility::Immutable,
),
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-nested/src/make_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl MakeArray {
pub fn new() -> Self {
Self {
signature: Signature::one_of(
vec![TypeSignature::ZeroArg, TypeSignature::UserDefined],
vec![TypeSignature::NullAry, TypeSignature::UserDefined],
Volatility::Immutable,
),
aliases: vec![String::from("make_list")],
Expand Down

0 comments on commit 825e714

Please sign in to comment.