From acb8763b98655fca331f2f251a802c001a819f35 Mon Sep 17 00:00:00 2001 From: tpz Date: Fri, 3 Nov 2023 23:12:59 +0100 Subject: [PATCH] feat: added `requested` flag to histograms buckets and hierarchy LevelInfos, updated unnecessary second build of the project in CI when building query validator --- .github/workflows/release.yml | 4 ++-- EvitaDB.Client/Converters/Models/ResponseConverter.cs | 4 +++- EvitaDB.Client/Models/ExtraResults/Hierarchy.cs | 6 +++--- EvitaDB.Client/Models/ExtraResults/IHistogram.cs | 2 +- EvitaDB.Client/Protos/GrpcExtraResults.proto | 4 ++++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42150bf..195259b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,8 +58,8 @@ jobs: - name: Build query validator run: | cd EvitaDB.QueryValidator - dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained false - dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained false + dotnet publish -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained false --no-build + dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained false --no-build - name: Zip uses: vimtor/action-zip@v1 diff --git a/EvitaDB.Client/Converters/Models/ResponseConverter.cs b/EvitaDB.Client/Converters/Models/ResponseConverter.cs index 6dd19f0..8f38934 100644 --- a/EvitaDB.Client/Converters/Models/ResponseConverter.cs +++ b/EvitaDB.Client/Converters/Models/ResponseConverter.cs @@ -221,6 +221,7 @@ GrpcLevelInfo grpcLevelInfo grpcLevelInfo.Entity is not null ? EntityConverter.ToEntity(entitySchemaFetcher, grpcLevelInfo.Entity, evitaRequest) : EntityConverter.ToEntityReference(grpcLevelInfo.EntityReference), + grpcLevelInfo.Requested, grpcLevelInfo.QueriedEntityCount, grpcLevelInfo.ChildrenCount, grpcLevelInfo.Items.Select(it => ToLevelInfo(entitySchemaFetcher, evitaRequest, entityFetch, it)).ToList() @@ -254,7 +255,8 @@ private static Bucket ToBucket(GrpcHistogram.Types.GrpcBucket grpcBucket) return new Bucket( grpcBucket.Index, EvitaDataTypesConverter.ToDecimal(grpcBucket.Threshold), - grpcBucket.Occurrences + grpcBucket.Occurrences, + grpcBucket.Requested ); } } \ No newline at end of file diff --git a/EvitaDB.Client/Models/ExtraResults/Hierarchy.cs b/EvitaDB.Client/Models/ExtraResults/Hierarchy.cs index f91548e..44e02b8 100644 --- a/EvitaDB.Client/Models/ExtraResults/Hierarchy.cs +++ b/EvitaDB.Client/Models/ExtraResults/Hierarchy.cs @@ -182,10 +182,10 @@ private void AppendLevelInfoTreeString(StringBuilder treeBuilder, LevelInfo leve } } -public record LevelInfo(IEntityClassifier Entity, int? QueriedEntityCount, int? ChildrenCount, List Children) +public record LevelInfo(IEntityClassifier Entity, bool Requested, int? QueriedEntityCount, int? ChildrenCount, List Children) { - public LevelInfo(LevelInfo levelInfo, List children) : this(levelInfo.Entity, - levelInfo.QueriedEntityCount, levelInfo.ChildrenCount, children) + public LevelInfo(LevelInfo levelInfo, List children) : + this(levelInfo.Entity, levelInfo.Requested, levelInfo.QueriedEntityCount, levelInfo.ChildrenCount, children) { } diff --git a/EvitaDB.Client/Models/ExtraResults/IHistogram.cs b/EvitaDB.Client/Models/ExtraResults/IHistogram.cs index 436ee93..ef88b60 100644 --- a/EvitaDB.Client/Models/ExtraResults/IHistogram.cs +++ b/EvitaDB.Client/Models/ExtraResults/IHistogram.cs @@ -8,4 +8,4 @@ public interface IHistogram public Bucket[] Buckets { get; } } -public record Bucket(int Index, decimal Threshold, int Occurrences); \ No newline at end of file +public record Bucket(int Index, decimal Threshold, int Occurrences, bool Requested); \ No newline at end of file diff --git a/EvitaDB.Client/Protos/GrpcExtraResults.proto b/EvitaDB.Client/Protos/GrpcExtraResults.proto index 29df108..9018638 100644 --- a/EvitaDB.Client/Protos/GrpcExtraResults.proto +++ b/EvitaDB.Client/Protos/GrpcExtraResults.proto @@ -40,6 +40,8 @@ message GrpcHistogram { // Contains number of entity occurrences in this bucket - e.g. number of entities that has monitored property value // between previous bucket threshold (exclusive) and this bucket threshold (inclusive) int32 occurrences = 3; + // Contains true if the `bucket` is overlapping the attribute between filtering constraint + bool requested = 4; } // Returns histogram buckets that represents a tuple of occurrence count and the minimal threshold of the bucket // values. @@ -106,6 +108,8 @@ message GrpcLevelInfo { google.protobuf.Int32Value childrenCount = 4; // Contains hierarchy info of the entities that are subordinate (children) of this `entity`. repeated GrpcLevelInfo items = 5; + // Contains true if the `entity` was filtered by hierarchy within constraint + bool requested = 6; } // This DTO contains detailed information about query processing time and its decomposition to single operations.