[NO ISSUE][FUN] Fix type inference and casting in UDFs - user model changes: no - storage format changes: no - interface changes: no
Details: The current UDF framework handles the argument types in a sloppy way. It takes in the arguments and reads them as the expected data types in the configuration. This could cause exception at runtime when passing in arguments with unexpected datatypes. When setting the arguments, it did a type casting for numeric values only to make sure the int64 from query interface can be evaluated properly. However, this is not robust enough.
This patch fixes the type inference for UDFs during the complation time. The ExternalTypeComputer is refactored to return defined data type, and meanwhile checks the argument data types. Also, the IntroduceDynamicTypeCastForExternalFunctionRule is modified to cover the type castings for data types besides record type.