-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add model validation to verify DbFunction's parameter types are mapped #13782
Comments
Triage: Discussed this as a case where we might want to change when/if we drop down to client evaluation. Most cases where a DbFunction mapping is being made it is because there is a desire to translate it to SQL. Not giving feedback when a use of the mapping cannot be translated doesn't help people find what they are doing wrong. We could, for example, detect in model validation some cases where we will never translate. |
There are two reasons a DbFunction won't translate. The first, as you found, is the inability to map a type for one of the parameters. The second reason is if the parameter is itself a function call which is not translatable. This can be because one of it's parameter types can't be mapped or it isn't a translatable function (DbFunction or builtin) You then end up having to go down the recursive rabbit hole until you work your way through all of the nested functions. I already have a set of unit tests defined in UdfDbFunctionSqlServerTests which test the various nesting/client eval scenarios and make sure translation is handled correctly. These all start with "Scalar_Nested_Function_". These can be leveraged and expanded to check for the warning messages once they are added. |
Breaking change covered by query changes. |
See example in #13752. If I try to use this function, which is defined correctly but doesn't work, then all I get is the NotImplementedException. I get no info as to what happened that causes it not to be used.
The text was updated successfully, but these errors were encountered: