-
Notifications
You must be signed in to change notification settings - Fork 332
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
Improve UDF handling in delegation strategy #2699
base: main
Are you sure you want to change the base?
Conversation
…uyen/filter-function-udf-delegation-strat
✅ No public API change. |
✅ No public API change. |
✅ No public API change. |
…uyen/filter-function-udf-delegation-strat
…//github.com/microsoft/Power-Fx into rnguyen/filter-function-udf-delegation-strat
src/libraries/Microsoft.PowerFx.Core/Functions/UserDefinedFunction.cs
Outdated
Show resolved
Hide resolved
...osoft.PowerFx.Core/Functions/Delegation/DelegationStrategies/DelegationValidationStrategy.cs
Outdated
Show resolved
Hide resolved
...osoft.PowerFx.Core/Functions/Delegation/DelegationStrategies/DelegationValidationStrategy.cs
Outdated
Show resolved
Hide resolved
✅ No public API change. |
…//github.com/microsoft/Power-Fx into rnguyen/filter-function-udf-delegation-strat
✅ No public API change. |
✅ No public API change. |
[Theory] | ||
[InlineData( | ||
"DelegatableUDF(Value: Number):Boolean = Value > 5;", | ||
"DelegatableUDF2():MyDataSourceTableType = Filter(MyDataSource, DelegatableUDF(Value));", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to support it at least for non-row scope scenarios. For row-scope scenarios, it gets complicated in translation which we need to design it well.
Using UDF which is non-row scope shouldn't make the parent function call non-delegable. This works today at least which is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example,
UDF2(Name:Text) = Name;
This UDF2 could be row-scoped or non-row scoped depending in the context it is used.
Filter(Accounts, Name = UDF2(Name)) --> Row scoped
Filter(Accounts, Name = UDF2("")) --> Non-Row scoped
This PR adds a flag that allows us to maintain UDF context when visiting UDF call nodes in delegation strategy. This is needed to provide accurate warnings when using UDF inside filter function args.