Class ProTreeQueryProvider
ProTreeQueryProvider - Aggregation for trees (partial).
CTE for tree traversal + aggregations.
DRY: Uses ProSqlBuilder for common operations.
public class ProTreeQueryProvider : SqliteTreeQueryProvider, ITreeQueryProvider, IRedbQueryProvider
Inheritance
Implements
Inherited Members
Methods
CreateFilterParser()
Pro: Uses ProFilterExpressionParser with arithmetic and function support
protected override ProFilterExpressionParser CreateFilterParser()
ExecuteAggregateAsync(long, string, AggregateFunction, string?, CancellationToken)
Execute aggregation on EAV field (SQL strategy for simple fields).
public override Task<decimal?> ExecuteAggregateAsync(long schemeId, string fieldPath, AggregateFunction function, string? filterJson = null, CancellationToken cancellationToken = default)
ExecuteAggregateBatchAsync(long, IEnumerable<AggregateRequest>, string?, CancellationToken)
Execute batch aggregation (multiple fields in one query).
public override Task<AggregateResult> ExecuteAggregateBatchAsync(long schemeId, IEnumerable<AggregateRequest> requests, string? filterJson = null, CancellationToken cancellationToken = default)
ExecuteArrayGroupQueryAsync(ArrayGroupQuery, CancellationToken)
Array grouping without a tree: the flat provider answers it.
public override Task<JsonDocument> ExecuteArrayGroupQueryAsync(ArrayGroupQuery query, CancellationToken cancellationToken = default)
ExecuteGroupedAggregateAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, string?, CancellationToken)
Execute GroupBy aggregation. Uses filterJson for Free version compatibility.
public override Task<JsonDocument?> ExecuteGroupedAggregateAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
ExecuteTreeAggregateAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<AggregateRequest>, CancellationToken)
Execute tree aggregation with CTE.
public Task<Dictionary<string, decimal?>> ExecuteTreeAggregateAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<AggregateRequest> aggregations, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeAnyAsync<TProps>(TreeQueryContext<TProps>, CancellationToken)
Pro Override: Tree Any as the list statement cut to one node (LIMIT 1, no ordering), the first column of
protected override Task<bool> ExecuteTreeAnyAsync<TProps>(TreeQueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeArrayGroupQueryAsync<TProps>(TreeQueryContext<TProps>, ArrayGroupQuery, CancellationToken)
Array grouping over the objects of a subtree. Base implementation: the ids of the subtree (roots, depth and
public override Task<JsonDocument> ExecuteTreeArrayGroupQueryAsync<TProps>(TreeQueryContext<TProps> context, ArrayGroupQuery query, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeCountAsync<TProps>(TreeQueryContext<TProps>, CancellationToken)
Pro Override: Tree Count via CTE + PVT.
protected override Task<int> ExecuteTreeCountAsync<TProps>(TreeQueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeGroupByAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, CancellationToken)
Execute GROUP BY on tree with CTE.
public Task<string> ExecuteTreeGroupByAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeGroupedAggregateAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, CancellationToken)
ITreeQueryProvider implementation: Execute GROUP BY with tree context.
public override Task<JsonDocument?> ExecuteTreeGroupedAggregateAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? havingJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeGroupedWindowQueryAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, CancellationToken)
Execute Tree GroupBy + Window query.
public override Task<JsonDocument?> ExecuteTreeGroupedWindowQueryAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? havingJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeToListAsync<TProps>(TreeQueryContext<TProps>, CancellationToken)
Pro Override: Tree ToList via CTE + PVT.
protected override Task<object> ExecuteTreeToListAsync<TProps>(TreeQueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeWindowAsync<TProps>(TreeQueryContext<TProps>, string, string, string, string, string?, CancellationToken)
Execute Window Functions on tree with CTE (legacy JSON version).
public Task<string> ExecuteTreeWindowAsync<TProps>(TreeQueryContext<TProps> context, string selectFieldsJson, string windowFunctionsJson, string partitionByJson, string orderByJson, string? frameJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteTreeWindowQueryAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, CancellationToken)
Execute Window Functions on tree with CTE (interface implementation).
public override Task<JsonDocument?> ExecuteTreeWindowQueryAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? frameJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteWindowQueryAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, int?, int?, CancellationToken)
Execute query with window functions (SQL function query_with_window).
public override Task<JsonDocument?> ExecuteWindowQueryAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? frameJson = null, int? take = null, int? skip = null, CancellationToken cancellationToken = default)
GetArrayGroupQuerySqlAsync(ArrayGroupQuery, CancellationToken)
SQL of .
public override Task<string> GetArrayGroupQuerySqlAsync(ArrayGroupQuery query, CancellationToken cancellationToken = default)
GetGroupBySqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, string?, CancellationToken)
Returns SQL preview for GroupBy query with tree constraints.
public override Task<string> GetGroupBySqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
GetSchemeAsync(long, CancellationToken)
Get scheme by ID (for projections) - delegate to base provider
public override Task<IRedbScheme?> GetSchemeAsync(long schemeId, CancellationToken cancellationToken = default)
GetSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, CancellationToken)
Pro: Tree SQL Preview (DRY - uses BuildTreeQuerySqlAsync)
public override Task<string> GetSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeAggregateSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<AggregateRequest>, CancellationToken)
SQL Preview for Tree Aggregate (DRY - same SQL as Execute)
public Task<string> GetTreeAggregateSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<AggregateRequest> aggregations, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeArrayGroupQuerySqlAsync<TProps>(TreeQueryContext<TProps>, ArrayGroupQuery, CancellationToken)
SQL of : the flat array grouping over the ids of the subtree.
public override Task<string> GetTreeArrayGroupQuerySqlAsync<TProps>(TreeQueryContext<TProps> context, ArrayGroupQuery query, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeGroupBySqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, CancellationToken)
SQL Preview for Tree GroupBy (DRY - same SQL as Execute)
public override Task<string> GetTreeGroupBySqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? havingJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeGroupedWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, CancellationToken)
SQL preview for Tree GroupBy + Window.
public override Task<string> GetTreeGroupedWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? havingJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, CancellationToken)
SQL Preview for Tree Window (typed interface version).
public override Task<string> GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? frameJson = null, CancellationToken cancellationToken = default) where TProps : class, new()
GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps>, string, string, string, string, string?, CancellationToken)
SQL Preview for Tree Window (DRY - same SQL as Execute)
public Task<string> GetTreeWindowSqlPreviewAsync<TProps>(TreeQueryContext<TProps> context, string selectFieldsJson, string windowFunctionsJson, string partitionByJson, string orderByJson, string? frameJson = null, CancellationToken cancellationToken = default) where TProps : class, new()