COF-C02 practice question 35 of 35

When referring to User-Defined Function (UDF) names in Snowflake, what does the term overloading mean?

Full set: 778 questions
Answer options
A: There are multiple SOL UDFs with the same names and the same number of arguments.
B: There are multiple SQL UDFs with the same names and the same number of argument types.
C: There are multiple SQL UDFs with the same names but with a different number of arguments or argument types. Correct answer
D: There are multiple SQL UDFs with different names but the same number of arguments or argument types.
Correct Answer:
C. There are multiple SQL UDFs with the same names but with a different number of arguments or argument types.
Explanation

In Snowflake, function overloading refers to the practice of defining multiple User-Defined Functions (UDFs) within the same schema that share the same name. To be valid, each of these functions must have a unique "argument signature." A signature is differentiated by either the total number of arguments or the data types of the arguments. This allows a single function name to be used for similar operations on different sets or types of input data, and Snowflake resolves which function to call based on the arguments provided.

Why Incorrect

A. This is incorrect. If the name and number of arguments are the same, the argument types must be different to constitute a valid overload.
B. This is incorrect. If the UDFs have the same name and the same argument types, it would result in an "ambiguous function name" error, not a valid overload.
D. This is incorrect. The core principle of overloading is using the same name for multiple functions, not different names.

References

1. Snowflake Documentation: SQL UDFs - Overloading UDFs.

Section/Paragraph: The documentation explicitly states

"Snowflake supports overloading of UDFs. Multiple UDFs in the same schema can have the same name

as long as their argument signatures differ

either by the number of arguments or the argument data types." This directly supports option C.

2. Snowflake Documentation: CREATE FUNCTION.

Section/Paragraph: Under the "Usage Notes" for creating UDFs

it details the rules for function resolution. It mentions that function names can be overloaded and that Snowflake uses the number and types of arguments to resolve which function to execute. This reinforces that the signature (number and type of arguments) must be unique for functions with the same name.

Scroll to Top