Files
documentdb/pg_helio_api
Ayush Saluja 31f018ff4d Merged PR 1442255: Update collstats response types
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)

### Are you introducing any new config? If yes, do you have tests with and without them being set?

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Our Collstats response is not line with the native mongo response.
Native mongo behaviour :
1) When we run collstats the response size and all fields are expected to be Int32
2) If they overflow the range for int32 in response the output is of type double

With this pr we change the PgbsonWriter to reflect the same functionality while sending final response

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for failing `coll_stats` JavaScript test.

#### PR Summary
This pull request addresses a bug in the `coll_stats` function by ensuring the correct data type is used for various statistics. It modifies the test output and the core implementation to handle integer and double values appropriately.
- `/pgmongo/src/test/regress/expected/commands_coll_stats.out`: Updated expected output to reflect correct data types (`$numberInt` and `$numberLong`).
- `/oss/pg_helio_api/src/commands/coll_stats.c`: Introduced `WriteStatsAsIntorDouble` helper function to decide whether to write stats as `int32` or `double`. Updated `WriteCoreStorageStats` and `BuildEmptyResponseMessage` to use this helper function.
2024-08-28 16:38:56 +03:00
..