Fix deriving of return type of user-defined functions.
Even though SqlValidator had overload detection and type resolution logic it did not fire since function.getFunctionType() == null was always false