From ca9a223249d2ec37ec25b42c49e4d6b0a4a626be Mon Sep 17 00:00:00 2001 From: jas-valgotar Date: Thu, 23 Jan 2025 11:45:06 -0500 Subject: [PATCH] Adds count capabilities. --- .../Public/CdpTableValue.cs | 5 ++++ .../Entities/External/TableDelegationInfo.cs | 26 +++++++++++++++++++ .../Public/Values/TableValue.cs | 8 ++++++ 3 files changed, 39 insertions(+) diff --git a/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs b/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs index 24f86efa87..cbb4651f56 100644 --- a/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs +++ b/src/libraries/Microsoft.PowerFx.Connectors/Public/CdpTableValue.cs @@ -66,6 +66,11 @@ public void Refresh() { _cachedRows = null; } + + public Task ExecuteQueryAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel) + { + throw new NotImplementedException(); + } } internal static class ODataParametersExtensions diff --git a/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs b/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs index d05ba68d06..c71aa34b51 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Entities/External/TableDelegationInfo.cs @@ -26,6 +26,9 @@ public abstract class TableDelegationInfo [Obsolete("preview")] public SummarizeCapabilities SummarizeCapabilities { get; init; } + [Obsolete("preview")] + public CountCapabilities CountCapabilities { get; init; } + // Defines ungroupable columns public GroupRestrictions GroupRestriction { get; init; } @@ -299,6 +302,29 @@ public enum SummarizeMethod CountRows } + [Obsolete("preview")] + public class CountCapabilities + { + public CountCapabilities() + { + } + + public virtual bool IsCountableTable() + { + return false; + } + + public virtual bool IsCountableAfterJoin() + { + return false; + } + + public virtual bool IsCountableAfterSummarize() + { + return false; + } + } + public sealed class FilterRestrictions { // List of required properties diff --git a/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs b/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs index 80383fa73d..b0c66eeae1 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Public/Values/TableValue.cs @@ -28,6 +28,14 @@ public interface IDelegatableTableValue /// /// Task>> GetRowsAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel); + + /// + /// Evaluation will invoke this method on aggregation calls where return value is scaler. + /// + /// Pre-eval services. + /// Delegation parameters. + /// + Task ExecuteQueryAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel); } ///