jayzhan211 commented on issue #10507:
URL: https://github.com/apache/datafusion/issues/10507#issuecomment-2275292135

   Signature does 3 things
   1. Length check
   2. Type check
   3. Coercion
   
   For length,
   the common length check are
   1. Exact number
   2. Variadic (Any number)
   3. VariadicNonZero (Any number but at least one)
   4. VariadicEven (Less common, i.e. Map)
   
   For types,
   We have two style, Exact and Coercion. Exact rejects if the type mismatch, 
Coercion rejects if teh type is not coercible to the target type.
   
   The combination of these are
   * `Uniform(Vec<DataType>)` // Exact Number with Exact type
   * `UniformCoercion(Vec<DataType>)` // Exact Number with coercion
   * `Variadic(DataType)`
   * `VariadicCoercion(DataType)`
   ...
   
   For non-uniform length and more then on data type signature, we could use 
`UserDefined`.
   
   
   The more tricky part is the DataType. We have many functions expect Numeric 
type that includes integer, float, ....
   For function that expects string, there are Utf8, LargeUtf8, Utf8View.
   
   For type checking, it would be nice to have more general Enum that includes 
more than one DataType to check against with.
   
   ```rust
   enum FunctionType {
    Numeric
    Integer
    Float
    ...
   }
   ```
   
   Now, we have
   ```rust
   * `Uniform(Vec<FunctionType>)` // Exact Number with Exact type
   * `UniformCoercion(Vec<FunctionType>)` // Exact Number with coercion
   * `Variadic(FunctionType)`
   * `VariadicCoercion(FunctionType)`
   ```
   
   TypeSignature::Numeric is one of the idea that comes out from it.
   For other kinds of complex type check or length check, we fall back to 
`UserDefined`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to