From 6ca3755d4e34278682664797edc1d9dcd05cdf2f Mon Sep 17 00:00:00 2001 From: jas-valgotar Date: Wed, 18 Dec 2024 17:04:58 -0500 Subject: [PATCH] enable summarize capabilities. --- .../Entities/External/TableDelegationInfo.cs | 26 ++++++++++++------- .../Public/Values/DelegationParameters.cs | 3 +++ .../PublicSurfaceTests.cs | 2 ++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs b/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs index bfc62c3358..08ee5073d5 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs @@ -23,7 +23,8 @@ public abstract class TableDelegationInfo // Used to indicate whether this table has selectable columns public SelectionRestrictions SelectionRestriction { get; init; } - public SummarizeRestrictions SummarizeRestriction { get; init; } + [Obsolete("preview")] + public SummarizeCapabilities SummarizeCapabilities { get; init; } // Defines ungroupable columns public GroupRestrictions GroupRestriction { get; init; } @@ -268,20 +269,25 @@ public SelectionRestrictions() } } - public sealed class SummarizeRestrictions + [Obsolete("preview")] + public class SummarizeCapabilities { - /// - /// List of properties that can not be summarized. - /// - public ICollection NonSummarizableProperties { get; init; } - - public ICollection NotSupportedSummarizeMethods { get; init; } - - public SummarizeRestrictions() + public virtual bool IsSummarizableProperty(string propertyName) + { + return false; + } + + public virtual bool IsSummarizableMethod(SummarizeMethod method) + { + return false; + } + + public SummarizeCapabilities() { } } + [Obsolete("preview")] public enum SummarizeMethod { None, diff --git a/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs b/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs index 9e3c9db056..f606401c19 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs @@ -73,6 +73,9 @@ public enum DelegationParameterFeatures // $apply Apply = 1 << 4, + // $apply = groupby((field1, ..), field with sum as TotalSum) + ApplyGroupBy = 1 << 5, + /* To be implemented later when needed diff --git a/src/tests/Microsoft.PowerFx.Core.Tests.Shared/PublicSurfaceTests.cs b/src/tests/Microsoft.PowerFx.Core.Tests.Shared/PublicSurfaceTests.cs index 6a9a8368f3..352871be4b 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests.Shared/PublicSurfaceTests.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests.Shared/PublicSurfaceTests.cs @@ -202,6 +202,8 @@ public void PublicSurface_Tests() "Microsoft.PowerFx.Core.Entities.IRefreshable", "Microsoft.PowerFx.Core.Entities.SelectionRestrictions", "Microsoft.PowerFx.Core.Entities.SortRestrictions", + "Microsoft.PowerFx.Core.Entities.SummarizeCapabilities", + "Microsoft.PowerFx.Core.Entities.SummarizeMethod", "Microsoft.PowerFx.Core.Entities.TableDelegationInfo", "Microsoft.PowerFx.Core.Functions.Delegation.DelegationOperator", "Microsoft.PowerFx.Core.Localization.ErrorResourceKey",