-
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
Moving dependency scan to CORE #2827
base: main
Are you sure you want to change the base?
Conversation
/// The formula "Name & 'Primary Contact'.'Full Name' & Sum(Contacts, 'Number Of Childeren')" would return | ||
/// "contact" => { "fullname", "numberofchildren" }. | ||
/// </example> | ||
public Dictionary<string, HashSet<string>> FieldReads { get; set; } |
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.
@@ -483,7 +483,27 @@ private void VerifyReturnTypeMatch() | |||
/// <summary> | |||
/// Compute the dependencies. Called after binding. | |||
/// </summary> | |||
public void ApplyDependencyAnalysis() |
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.
Yes, I'll make the change.
if (!IsSuccess) | ||
{ | ||
return null; | ||
} |
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.
nit - needed? Let ApplyIR() handle this. #Resolved
@@ -19,7 +19,8 @@ | |||
using Microsoft.PowerFx.Syntax; | |||
using Microsoft.PowerFx.Types; | |||
using CallNode = Microsoft.PowerFx.Syntax.CallNode; | |||
using RecordNode = Microsoft.PowerFx.Core.IR.Nodes.RecordNode; | |||
using IRCallNode = Microsoft.PowerFx.Core.IR.Nodes.CallNode; |
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.
✅ No public API change. #Resolved |
// The return value is used by DepedencyScanFunctionTests test case. | ||
// Returning false to indicate that the function runs a basic dependency scan. | ||
// Other functions can override this method to return true if they have a custom dependency scan. | ||
return false; |
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.
What do these semantics mean? Ie, what is a caller supposed to do differently if we return true vs. false?
#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.
Discussed internally.
} | ||
} | ||
else | ||
{ |
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.
Why do we need this logic? #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.
Removed.
|
||
public class DependencyContext | ||
{ | ||
public bool WriteState { get; set; } |
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.
|
||
if (fieldLogicalName != null) | ||
{ | ||
var name = Translate(tableLogicalName, fieldLogicalName); |
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.
Yes, from DV side.
public string Translate(string tableLogicalName, string fieldLogicalName) | ||
{ | ||
return fieldLogicalName; | ||
} |
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? #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.
Yes, from DV side.
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.
ah, it's virtual now ;)
[InlineData("Min(local,numberofemployees)", "Read Accounts: numberofemployees;")] | ||
[InlineData("Average(local,numberofemployees)", "Read Accounts: numberofemployees;")] | ||
|
||
// Patch |
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.
Test:
Patch(local, First(local), { field1 : First(local).field2 } )
local.field1 is a write.
local.field2 is a read
#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.
Test case added.
var functions = new List<TexlFunction>(); | ||
functions.AddRange(BuiltinFunctionsCore.BuiltinFunctionsLibrary); | ||
|
||
var exceptionList = new HashSet<string>() |
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.
What is the rule what is on this list? #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.
+1, is this planed for future?
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 added.
Merging main branch.
} | ||
|
||
// Some functions might require an different dependecy scan. This test case is to ensure that any new functions that | ||
// is not self-contained or has a scope info has been assessed and either added to the exception list or has a dependency scan. |
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.
|
||
public class DependencyContext | ||
{ | ||
public bool WriteState { get; set; } |
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.
} | ||
else | ||
{ | ||
continue; |
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.
// Set | ||
[InlineData("Set(numberofemployees, 200)", "Write Accounts: numberofemployees;")] | ||
[InlineData("Set('Address 1: City', 'Account Name')", "Read Accounts: name; Write Accounts: address1_city;")] | ||
[InlineData("Set('Address 1: City', 'Address 1: City' & \"test\")", "Read Accounts: address1_city; Write Accounts: address1_city;")] |
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.
// Some functions might require an different dependecy scan. This test case is to ensure that any new functions that | ||
// is not self-contained or has a scope info has been assessed and either added to the exception list or has a dependency scan. | ||
[Fact] | ||
public void DepedencyScanFunctionTests() |
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.
✅ No public API change. |
/// <summary> | ||
/// Compute the dependencies. Called after binding. | ||
/// </summary> | ||
public DependencyInfo ApplyDependencyInfoScan() |
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.
Issue #2809.