From 2921b16e7509f86e4b27971b026c2c0e944ce3ed Mon Sep 17 00:00:00 2001 From: jas-valgotar Date: Thu, 23 Jan 2025 14:33:42 -0500 Subject: [PATCH] adds Supported features check. --- .../Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs | 5 +++++ .../Public/Values/DelegationParameters.cs | 6 +++--- .../Microsoft.PowerFx.Core/Public/Values/TableValue.cs | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs b/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs index cbb4651f56..c299b76506 100644 --- a/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs +++ b/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs @@ -44,6 +44,11 @@ internal CdpTableValue(IRContext irContext) public override IEnumerable> Rows => GetRowsAsync(null, null, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult(); + public DelegationParameterFeatures SupportedFeatures => DelegationParameterFeatures.Filter | + DelegationParameterFeatures.Top | + DelegationParameterFeatures.Columns | // $select + DelegationParameterFeatures.Sort; // $orderby + public async Task>> GetRowsAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel) { if (parameters == null && _cachedRows != null) diff --git a/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs b/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs index a4a4f2dde8..d328e8d425 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Public/Values/DelegationParameters.cs @@ -76,15 +76,15 @@ public enum DelegationParameterFeatures // $apply = groupby((field1, ..), field with sum as TotalSum) ApplyGroupBy = 1 << 5, + // $count + Count = 1 << 6, + /* To be implemented later when needed // $compute Compute = 1 << 5, - // $count - Count = 1 << 6, - // $expand Expand = 1 << 7, diff --git a/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs b/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs index 01debd059d..42e70f6847 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs @@ -37,6 +37,11 @@ public interface IDelegatableTableValue /// Delegation parameters. /// Task ExecuteQueryAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel); + + /// + /// Supported features for delegation to verify correct Features are delegated at runtime. + /// + DelegationParameterFeatures SupportedFeatures { get; } } ///