jayzhan211 commented on code in PR #9108:
URL: https://github.com/apache/arrow-datafusion/pull/9108#discussion_r1502226849
##########
datafusion/expr/src/signature.rs:
##########
@@ -272,11 +254,28 @@ impl ArrayFunctionSignature {
ArrayFunctionSignature::ElementAndArray => {
array_append_or_prepend_valid_types(current_types, false)
}
- ArrayFunctionSignature::ArrayAndIndex =>
array_and_index(current_types),
+ ArrayFunctionSignature::ArrayAndIndex => {
+ if current_types.len() != 2 {
+ return Ok(vec![vec![]]);
+ }
+ array(¤t_types[0]).map_or_else(
+ || Ok(vec![vec![]]),
+ |array_type| Ok(vec![vec![array_type, DataType::Int64]]),
Review Comment:
👍
##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -208,21 +110,9 @@ fn get_valid_types(
}
TypeSignature::Exact(valid_types) => vec![valid_types.clone()],
- TypeSignature::ArraySignature(ref function_signature) => match
function_signature
- {
- ArrayFunctionSignature::ArrayAndElement => {
- return array_append_or_prepend_valid_types(current_types, true)
- }
- ArrayFunctionSignature::ArrayAndElementAndOptionalIndex => {
- return array_element_and_optional_index(current_types)
- }
- ArrayFunctionSignature::ArrayAndIndex => {
- return array_and_index(current_types)
- }
- ArrayFunctionSignature::ElementAndArray => {
- return array_append_or_prepend_valid_types(current_types,
false)
- }
- },
+ TypeSignature::ArraySignature(ref function_signature) => {
+ function_signature.get_type_signature(current_types)?
Review Comment:
We may not need `get_type_signature` but inline matching function instead
--
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]