-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The get_valid_types function works correctly when the type signature is TypeSignature::Numeric(n) with n > 1. However, it behaves incorrectly when n = 1.
This is because the function first attempts to coerce data types into a numeric type. Such coercion is only performed when the number of arguments is greater than 1, but it does not check if the single data type is numeric when there's only one argument.
To Reproduce
You can write a simple unit test to reproduce the error:
#[test]
fn test_get_valid_types_numeric() -> Result<()> {
let signature = TypeSignature::Numeric(1);
// Returns ok while it's expected to return err.
let got = get_valid_types(&signature, &[DataType::Binary]);
assert!(got.is_ok());
Ok(())
}Expected behavior
The get_valid_types functions rejects non-numeric arguments when given TypeSignature::Numeric(1).
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working