-
Notifications
You must be signed in to change notification settings - Fork 334
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
Unifying Remove function with PA #2776
base: main
Are you sure you want to change the base?
Conversation
65b5f6c
to
5e675d8
Compare
✅ No public API change. #Resolved |
3 similar comments
✅ No public API change. #Resolved |
✅ No public API change. #Resolved |
✅ No public API change. #Resolved |
4619d74
to
8983927
Compare
✅ No public API change. #Resolved |
1 similar comment
✅ No public API change. #Resolved |
9dbde75
to
617a7fd
Compare
✅ No public API change. #Resolved |
2 similar comments
✅ No public API change. #Resolved |
✅ No public API change. #Resolved |
4ea55b9
to
42a16ef
Compare
✅ No public API change. #Resolved |
1 similar comment
✅ No public API change. #Resolved |
src/libraries/Microsoft.PowerFx.Core/Public/Values/CollectionTableValue.cs
Outdated
Show resolved
Hide resolved
{ | ||
return errorRecord.Error; | ||
} | ||
} |
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 should discuss this.
This is eagerly scanning the entire table. Can we confirm that's the language semantics?
The danger is:
- that could be a lot of work upfront
- that could prevent future optimizations
- in paging/delegation cases, we don't download entire table . It could be a random set of rows. If there are error rows, they may or may not show up in that random set.
✅ No public API change. #Resolved |
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.
236b991
to
9f00032
Compare
✅ No public API change. #Resolved |
9f00032
to
1bf13e3
Compare
✅ No public API change. #Resolved |
return base.TryGetTypeForArgSuggestionAt(argIndex, out type); | ||
} | ||
|
||
public RemoveBaseFunction(int arityMax, params DType[] paramTypes) |
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.
[minor] Can you move those function declarations after the constructor for consistency?
If(true, {test:1}, "Void value (result of the expression can't be used).") | ||
|
||
>> t4 | ||
Table() |
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.
Not sure if all of those are covered, but we should have them:
Setup:
ClearCollect(coll, {a:1}, {a:2}, {a:3}, {a:4}, {a:5}, {a:4}, {a:3}, {a:2})
Cases:
Remove(coll, [{a:2}], RemoveFlags.First) // Simple case, First (single element)
-> At the end: 1,3,4,5,4,3,2
Remove(coll, [{a:2}], RemoveFlags.All) // Simple case, All (single element)
-> At the end: 1,3,4,5,4,3
Remove(coll, [{a:2},{a:3}], RemoveFlags.First) // Simple case, First (multiple elements)
-> At the end: 1,4,5,4,3,2
Remove(coll, [{a:2},{a:3}], RemoveFlags.All) // Simple case, All (multiple elements)
-> At the end: 1,4,5,4
Remove(coll, [{a:2},{a:6}], RemoveFlags.First) // Only remove found elements, ignore others, First
-> At the end: 1,3,4,5,4,3,2
Remove(coll, [{a:2},{a:9}], RemoveFlags.All) // Only remove found elements, ignore others, All
-> At the end: 1,3,4,5,4,3
Remove(coll, ForAll(Sequence(5),{a:Value}), RemoveFlags.First) // Match all elements, First
-> At the end: 4,3,2
Remove(coll, ForAll(Sequence(5),{a:Value}), RemoveFlags.First) // Match all elements, All
-> At the end:
Remove(coll, {Value:1}, [{Value:2}])
-> Mixing record and tables should result in a compile-time error
@@ -3,6 +3,7 @@ | |||
|
|||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; |
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.
Needed?
@@ -3291,21 +3291,41 @@ | |||
<comment>function_parameter - Second argument to the Patch function - the updates to be applied to the given rows.</comment> | |||
</data> | |||
<data name="AboutRemove" xml:space="preserve"> | |||
<value>Removes a specific record or records from a data source</value> | |||
<value>Removes (optionally All) items from the specified 'collection'.</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.
</data> | ||
<data name="ErrRemoveAllArg" xml:space="preserve"> | ||
<value>If provided, last argument must be 'RemoveFlags.All'. Is there a typo?</value> | ||
<comment>{Locked=RemoveFlags.All} Error Message, RemoveFlags.All is an enum value that does not get localized.</comment> | ||
</data> | ||
<data name="AboutRemove_collection" xml:space="preserve"> | ||
<value>The collection to remove rows from.</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.
<value>data_source</value> | ||
<comment>function_parameter - First parameter for the Remove function. The data source that contains the records that you want to remove from. Translate this string. When translating, maintain as a single word (i.e., do not add spaces).</comment> | ||
<data name="RemoveArg1" xml:space="preserve"> | ||
<value>collection</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.
<comment>function_parameter - Third argument for the Remove function - value indicating whether to remove all matches or only the first one.</comment> | ||
</data> | ||
<data name="AboutRemove_all" xml:space="preserve"> | ||
<value>An optional argument that specifies whether to remove all matches, or just the first one.</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.
The "base" test Remove.txt already defines PowerFxCompatibilityRules, the cases in this file can be merged into the base one. Refers to: src/tests/Microsoft.PowerFx.Core.Tests.Shared/ExpressionTestCases/Remove_V1Compact.txt:1 in 1bf13e3. [](commit_id = 1bf13e3, deletion_comment = False) |
Add new connector setting _UseItemDynamicPropertiesSpecialHandling_ Remove _UseDefaultBodyNameForSinglePropertyObject_ as it was not fixing the issue as expected Special case handling when - body name is 'item' - body inner object is 'dynamicProperties' - there is only one property in inner object In that base the body will be fully flattened and we will retain the 'body' name for the parameter.
Address #2751. This unifies most of them. To scope this PR, there are subissues on 2751 for remaining issues. We have a plethora of IAsyncTexlFunction* interfaces. Want to consolidate on 1, and make it public. This Ttake the parameters on the various IAsyncTexlFunction* overloads and move them as properties on a new public `FunctionInvokerInfo` class. And then have a new IAsyncTexlFunction* that takes the invoker. And remove all the others, migrating them onto this - and fixing the various bugs/hacks along the way that would impede migration. Most fundamentally, this FunctionInvokerInfo must have access to interpreter state and so must live in the interpreter. (Whereas some of the IAsyncFunction* interfaces live in core). Successfully removes several here so we get a net reduction, and shows a path to remove the rest. This problem quickly touches other problems: - **How to map from the TexlFunction to the invoker**. This is made more complicated because we register on PowerFxConfig, but that lives in Fx.Core and can't refer to interpreter implementations. - **dll layering around Fx.Json**: Some function implementations live in Fx.Json, but that specifically _does not_ depend on interpreter (because it is included by PowerApps). - **Standard Pipeline**: how to handle default args, common error handling scenarios, etc. Today, that's still in interpreter. Whereas we really want those checks to be in the IR and shared across front-ends (and available to designer). - **Split up Library.cs and class** - we have one giant class, partial over many files, containing 100s of function impls. Just give each impl its own file, similar to how we did for TexlFunction and the static declarations. - **lack of unit testing**: Today, most of our interpreter coverage comes from .txt files. But we should have C# unit tests on interpreter classes that provide coverage on core classes, like EvalVisitor. Some related prereq fixes that will directly help here: - Can we remove runner/context from Join? and leverage LambdaValue - which already closes over these. - fix Json layering problem. - IsType/AsType _UO shouldn't live in Json. They should work on any UO. - Remove _additionalFunctions from the serviceProvider. --------- Co-authored-by: Mike <[email protected]>
✅ No public API change. |
Issue #2808.