From ec6a642c494996b347f8de1fa7343f1bafe0b95a Mon Sep 17 00:00:00 2001 From: Deepak Bisht Date: Fri, 20 Sep 2024 06:59:55 +0000 Subject: [PATCH] Merged PR 1458010: update comments for setwindowfields JStests ### Does this PR have any customer impact? no ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Comments ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) no ### Are you introducing any new config? If yes, do you have tests with and without them being set? no ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) na ### Description update comments for setwindowfields JStests ---- #### AI description (iteration 1) #### PR Classification Documentation update for JStests related to `setWindowFields`. #### PR Summary This pull request updates comments and error messages for JStests related to `setWindowFields` to provide more accurate descriptions of the failures. - `/gateway/managed/Tests.Integration.Shell.Postgres/60_postgres_10260.csv`: Updated failure reasons for various `setWindowFields` tests. - `/oss/pg_helio_api/src/commands/coll_stats.c`: Added validation to ensure `$collStats.count` is an empty object. - `/oss/mongoerrors.csv`, `/oss/pg_helio_core/include/utils/helio_errors.h`, `/oss/pg_helio_core/include/utils/helio_codes.txt`: Added new error code `Location31170`. - `/oss/pg_helio_api/src/commands/commands_common.c`: Added `apiStrict` to ignored common spec fields. --- mongoerrors.csv | 1 + pg_helio_api/src/commands/coll_stats.c | 8 ++++++++ pg_helio_core/include/utils/helio_codes.txt | 1 + pg_helio_core/include/utils/helio_errors.h | 3 +++ 4 files changed, 13 insertions(+) diff --git a/mongoerrors.csv b/mongoerrors.csv index 32f938fa..ba4119b9 100644 --- a/mongoerrors.csv +++ b/mongoerrors.csv @@ -184,6 +184,7 @@ Location31109,31109,183 Location31119,31119,184 Location31120,31120,185 Location31138,31138,186 +Location31170,31170,490 Location31249,31249,187 Location31250,31250,188 Location31253,31253,189 diff --git a/pg_helio_api/src/commands/coll_stats.c b/pg_helio_api/src/commands/coll_stats.c index 34e4955e..36797f2d 100644 --- a/pg_helio_api/src/commands/coll_stats.c +++ b/pg_helio_api/src/commands/coll_stats.c @@ -191,6 +191,14 @@ command_coll_stats_aggregation(PG_FUNCTION_ARGS) { /* This is fine: validate */ EnsureTopLevelFieldValueType("$collStats.count", value, BSON_TYPE_DOCUMENT); + if (!IsBsonValueEmptyDocument(value)) + { + ereport(ERROR, (errcode(ERRCODE_HELIO_LOCATION31170), + errmsg("expected an empty object, but got %s", + BsonValueToJsonForLogging(value)), + errdetail_log( + "expected an empty object for `count` in $collStats"))); + } aggregateMode |= CollStatsAggMode_Count; } else if (strcmp(key, "queryExecStats") == 0) diff --git a/pg_helio_core/include/utils/helio_codes.txt b/pg_helio_core/include/utils/helio_codes.txt index cabf82ab..c90b7574 100644 --- a/pg_helio_core/include/utils/helio_codes.txt +++ b/pg_helio_core/include/utils/helio_codes.txt @@ -488,3 +488,4 @@ Location5624901,M00DH,5624901,486 Location6050202,M00DI,6050202,487 Location6050204,M00DJ,6050204,488 Location5788604,M00DK,5788604,489 +Location31170,M00DL,31170,490 diff --git a/pg_helio_core/include/utils/helio_errors.h b/pg_helio_core/include/utils/helio_errors.h index 527071f3..2460ad54 100644 --- a/pg_helio_core/include/utils/helio_errors.h +++ b/pg_helio_core/include/utils/helio_errors.h @@ -1533,4 +1533,7 @@ typedef int HelioErrorEreportCode; #define ERRCODE_HELIO_LOCATION5788604 MAKE_SQLSTATE('M', '0', '0', 'D', 'K') #define MONGO_CODE_LOCATION5788604 5788604 +#define ERRCODE_HELIO_LOCATION31170 MAKE_SQLSTATE('M', '0', '0', 'D', 'L') +#define MONGO_CODE_LOCATION31170 31170 + #endif