jorgecarleitao commented on pull request #7967:
URL: https://github.com/apache/arrow/pull/7967#issuecomment-674413020


   > @jorgecarleitao This looks good but I have one concern/question. What 
happens if I declare a function with two args and both args can be Float32 or 
Float64, but when I call it, one arg is i8 and the other arg is f64? Would they 
both get cast to f64 in this case? or would one be cast to f32 and the other to 
f64? The latter would not work if the function requires both types to be the 
same.
   
   Great point! I have not though about those types of constraints so far.
   
   This currently does not have constraints on "arguments have to be the same"; 
it assumes that the function handles each variation of the arguments 
independently: in your example, it would be coerced to f32 and f64. We can 
expand it to include constraints and "get_supertype" taking into account those 
constraints.
   
   The alternative is for `[[t1, t2]]` to represent one valid set of types for 
a function of two arguments, instead of `[[t1], [t2]]`. This way we can 
constraint arguments together. We would need to check that each entry on the 
list has the same number of entries = arguments.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to