Some functions can only be nullable if their arguments are nullable (e.g. ToUpper, SubString). This results in much simpler and faster SQL - by removing unnecessary function calls to determine if the values are null we can levarage indexes better.
Some functions (e.g. DATEDIFF) use some of the arguments to determine its nullability but not all of them.
Some functions (e.g. JSON_VALUE) can be null even when neither of its arguments are null.
We should add metadata for the built-in functions so we know how to deal with their nullability, as well as provide means for user defined functions to specify how they should behave