Skip to content
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

Closed
ajcvickers opened this issue Oct 26, 2018 · 3 comments · Fixed by #16182
Closed

Add model validation to verify DbFunction's parameter types are mapped #13782

ajcvickers opened this issue Oct 26, 2018 · 3 comments · Fixed by #16182
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-3.0 type-enhancement
Milestone

Comments

@ajcvickers
Copy link
Member

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.

@ajcvickers
Copy link
Member Author

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.

@pmiddleton
Copy link
Contributor

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.

@smitpatel smitpatel changed the title No indication of why a function mapping is not used Allow configuring facets of UDF parameters Jan 16, 2019
@smitpatel smitpatel changed the title Allow configuring facets of UDF parameters Allow configuring typemapping of UDF parameters Jan 16, 2019
@smitpatel smitpatel changed the title Allow configuring typemapping of UDF parameters Add model validation to verify DbFunction's parameter types are mapped Jan 16, 2019
@smitpatel smitpatel removed this from the 3.0.0 milestone Jan 16, 2019
@ajcvickers ajcvickers added this to the 3.0.0 milestone Jan 18, 2019
@ajcvickers ajcvickers removed this from the 3.0.0 milestone Mar 8, 2019
@ajcvickers
Copy link
Member Author

Breaking change covered by query changes.

smitpatel pushed a commit that referenced this issue Jun 21, 2019
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 21, 2019
@smitpatel smitpatel modified the milestones: Backlog, 3.0.0 Jun 21, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-3.0 type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants