Skip to content

Consider adding TypeSignatureClass::Any variant #19438

Description

@Jefffrey

Is your feature request related to a problem or challenge?

Considering a PR like this: #19435

It needs to accept an arbitrary expression for the first argument but an optional string argument for the second. There isn't really a good way to represent this in the current signature API, without doing the checks inside the function itself (as is done).

Describe the solution you'd like

Add an Any variant so we can specify a signature like TypeSignatureClass::Any, TypeSignatureClass::Native(logical_string()) to encode this information in the signature.

Describe alternatives you've considered

No response

Additional context

/// Represents the class of types that can be used in a function signature.
///
/// This is used to specify what types are valid for function arguments in a more flexible way than
/// just listing specific DataTypes. For example, TypeSignatureClass::Timestamp matches any timestamp
/// type regardless of timezone or precision.
///
/// Used primarily with [`TypeSignature::Coercible`] to define function signatures that can accept
/// arguments that can be coerced to a particular class of types.
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Hash)]
pub enum TypeSignatureClass {
Timestamp,
Time,
Interval,
Duration,
Native(LogicalTypeRef),
Integer,
Float,
Decimal,
Numeric,
/// Encompasses both the native Binary/LargeBinary types as well as arbitrarily sized FixedSizeBinary types
Binary,
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions