Commit Graph
371 Commits
Author SHA1 Message Date
Duan Pei✨ f2e84f4881 Merged PR 1456663: [Feature] $maxN/$minN with setWindowFields stage
### 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

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds support for `$maxN` and `$minN` operators in the `setWindowFields` stage.

#### PR Summary
This pull request introduces the `$maxN` and `$minN` window aggregation operators, including their syntax validation and handling.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c`: Added functions to handle `$maxN` and `$minN` operators, including syntax validation.
- `pgmongo/src/test/regress/sql/bson_aggregation_pipeline_stage_setWindowFields.sql`: Added tests for `$maxN` and `$minN` operators with various window configurations.
- `pgmongo/src/test/regress/expected/setwindowfields_and_group_compliance.out`: Updated compliance tests to reflect support for `$maxN` and `$minN` in `setWindowFields`.
2024-09-19 20:36:13 +03:00
Parag Jain 98f164e89c Merged PR 1458853: [Cleanup] Merge Legacy Cleanup PR
### 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
Before 1.20 release join condition we were not pushing down to index so in join function itself we use to validate `on` field values and compare target with source. but In 1.20 we have introduced index index push down for join condition where we are using support function for `bson_dollar_merge_join` so we validate on fields values in source projection itself using `bson_dollar_extract_merge_filter`.

So now as part of this PR we are at 1.20+ so removed older code bits which we are not going to use.

this was the PR where we have introduced index pushdown
https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1425893
2024-09-19 20:36:13 +03:00
Lusen Dong 0ed2fb5e42 Merged PR 1456650: More tests and new log error schema on integral operator
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Testing
### 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))

### Description

----
#### AI description  (iteration 1)
#### PR Classification
New feature and code improvement.

#### PR Summary
This pull request implements the `$derivative` stage aggregation operator and refines error handling in the integral operator.
- `bson_aggregation_window_operators.c`: Improved error handling and calculation of time units for the integral operator.
- `bson_aggregation_statistics.c`: Updated error code for internal errors in handling integral and derivative operations.

Related work items: #2151582
2024-09-19 20:36:13 +03:00
Deepak Bisht 91e5f2226f Merged PR 1458099: [Final] [Port Errors] - Move all errors to helio_errors, remove all referrences to mongo_errors.h
### Does this PR have any customer impact?
no

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

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

### 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
1. Move all legacy errors to new helio errors
2. Remove all refs to mongo_errors.h excluding error_utils.c , there is function which needs backword compatibility
3. Update `scripts/validate_helio_extension_state.sh` to enforce all validations on oss/pg_helio_api parent directory instead of individual sub directories

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup and deprecation.

#### PR Summary
This pull request moves all error handling to `helio_errors` and removes references to `mongo_errors.h`, deprecating certain functions.
- `error_utils.c`: Deprecated `command_throw_mongo_error` and `command_convert_mongo_error_to_postgres` functions.
- `mongo_errors.h`: Removed Mongo error handling code and redefined error code checks.
- `validate_helio_extension_state.sh`: Updated validation script to remove checks for `mongo_errors.h`.
- Added new SQL functions for database commands in `kill_op--1.22-0.sql`, `get_shard_key_value--1.22-0.sql`, and `reindex--1.22-0.sql`.
- Updated test files to reflect deprecation changes in error handling functions.
2024-09-19 20:36:13 +03:00
Jayanta Mondal d0bb21a7ff Merged PR 1457106: [engline] Setting enableCollation to false by default
### Does this PR have any customer impact?

No, but setting to true was

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

Bugfix

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

N/A

### 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))

N/A

### Description

Setting enableCollation to false by default

----
#### AI description  (iteration 1)
#### PR Classification
Configuration change to set `enableCollation` to false by default.

#### PR Summary
This pull request modifies the default setting for collation support in the BSON initialization code.
- `oss/pg_helio_core/src/bson_init.c`: Changed `DEFAULT_ENABLE_COLLATION` from `true` to `false`.
2024-09-19 20:36:13 +03:00
Gledis Zeneli 6d239e3edc Add [Deb, Ubuntu] x [PG 15, PG 16] Packaging (#58)
Add automated script for extension packaging.
The script enables packaging and testing for all combinations of
`[Debian 12, Debian 11, Ubuntu 24.04, Ubuntu 22.04, Ubuntu 20.04] x [PG
16, PG 15]`
2024-09-19 18:57:15 +03:00
Amit Prabhudesai 8fdb33dc6a Merged PR 1454239: [OSS] Port more errors to oss (M of N)
### 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
[OSS] Port more errors to oss (M of N)

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup and error handling improvement.

#### PR Summary
This pull request ports more error codes to the OSS (Open Source Software) version, replacing existing error codes with `ERRCODE_HELIO_*` equivalents and improving error detail logging.
- `bson_aggregation_output_pipeline.c`: Replaced various `Mongo*` error codes with `ERRCODE_HELIO_*` equivalents and updated error messages to use `errdetail_log`.
- `bson_aggregation_pipeline.c`: Updated error handling to use `ERRCODE_HELIO_*` equivalents and improved error detail logging.
- `bson_aggregation_nested_pipeline.c`: Replaced `Mongo*` error codes with `ERRCODE_HELIO_*` equivalents and enhanced error detail logging.
- `bson_project_operator.c`: Updated positional projection error handling to use `ERRCODE_HELIO_*` equivalents.
- `commands_update.out`: Updated expected error codes in test outputs to match new `ERRCODE_HELIO_*` values.
2024-09-12 13:51:02 +03:00
Duan Pei✨ 7fd8660ac4 Merged PR 1363174: [Feature] $maxN/$minN Aggregation Accumulator
### 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

We cannot reuse the logic of firstN in the sort stag because the sort by key of the sort stage is a field, and the input and N of maxN are both expressions. maxN needs to sort the entire input expression.

for example :
input can be a expression:
![image (10).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1363174/attachments/image%20%2810%29.png)

N also can be a expression:
![image (11).png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1363174/attachments/image%20%2811%29.png)

before the transition function, we need to evaluate input and n.

In the new implementation, we maintain a binaryHeap, the top of heap is maximum/minimum value.

For maxN:
**In transition funciton** :we need to maintain a small root heap and compare the current value with the top of the heap (minimum value). If the current value is greater than the top of the heap (minimum value), then we will pop the top of the heap and insert the current value.

**In the combine function,** each value of the left heap needs to be compared with the top of the right heap. If the conditions are met, the top of the right heap is popped out and the value is inserted. Each time, it is popped out from the left heap until the left heap is empty.
2024-09-12 13:51:02 +03:00
Cornelius Boateng 1181330b3b Merged PR 1450898: [Perf] Miscellaneous Aggregation Ops
### Does this PR have any customer impact?

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

### 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))

### Description
Migrate `$rand` and `$meta` to the new aggregation framework.
$rand does not need to exploit caching random constant values

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement for miscellaneous aggregation operations.

#### PR Summary
This pull request optimizes and refactors various aggregation operations to enhance performance.
- Added and reordered function declarations in `include/operators/bson_expression_operators.h` for better organization.
- Implemented `ParseDollarRand` and `HandlePreParsedDollarRand` functions in `src/operators/bson_expression_miscellaneous_operators.c` to handle `$rand` expressions.
- Added `ParseDollarMeta` and `HandlePreParsedDollarMeta` functions in `src/operators/bson_expression_miscellaneous_operators.c` to handle `$meta` expressions.
- Updated `src/operators/bson_expression.c` to integrate new parsing and handling functions for `$rand` and `$meta` expressions.

Related work items: #3458675
2024-09-12 13:51:02 +03:00
Deepak Bisht a30d2cdfbe Merged PR 1455470: Port to new errors in operators, planners, query, schema_validation directories
### Does this PR have any customer impact?
no

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

### 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
Port to new errors in operators, planners, query, schema_validation directories

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to port to new error handling in specific directories.

#### PR Summary
This pull request updates error handling mechanisms in the `operators`, `planners`, `query`, and `schema_validation` directories.
- Modified `pgmongo/src/test/regress/expected/bson_query_operator_tests_index.out` to update error messages and hints for various BSON query operators.
2024-09-12 13:51:02 +03:00
Parag Jain 194a418c6f Merged PR 1455447: [oss] error code cleanup for oss
### 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

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request focuses on cleaning up error code handling related to MongoDB errors.
- Removed MongoDB-specific error handling from `oss/pg_helio_api/include/utils/mongo_errors.h`.
- Moved MongoDB error handling logic to `oss/pg_helio_core/include/utils/error_utils.h`.
- Updated various source files to include `utils/helio_errors.h` instead of `utils/mongo_errors.h`.
- Modified `scripts/validate_helio_extension_state.sh` to check for MongoDB error codes in additional directories.
2024-09-12 13:51:02 +03:00
Deepak Bisht d964b664e9 Merged PR 1454469: Cleanup - Remove vCore referrence from OSS code
### Does this PR have any customer impact?
no

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

### 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
Cleanup - Remove vCore referrence from OSS code

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to remove references to vCore from the OSS code.

#### PR Summary
This pull request removes references to vCore from the OSS codebase and updates error messages accordingly.
- `bson_aggregation_window_operators.c`: Updated error messages to remove vCore version references and replaced them with generic "not supported yet" messages.
- `bson_aggregation_window_operators.c`: Changed error codes for unsupported commands to `ERRCODE_HELIO_COMMANDNOTSUPPORTED`.
- `bson_aggregation_window_operators.c`: Updated comments to replace "vCore specific options" with "helio specific options".
2024-09-12 13:51:02 +03:00
Lusen Dong 4c20fb3e1d Merged PR 1455392: fix memory corruption in $integral window operator
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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))

### Description

fix memory corruption

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address memory corruption in the `$integral` window operator.

#### PR Summary
This pull request fixes a memory corruption issue in the `$integral` window operator by modifying how string memory is allocated and managed.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c`: Replaced manual string allocation and copying with `StringInfo` for safer memory handling.

Related work items: #2151586
2024-09-12 13:51:02 +03:00
Xiaochun Liang 4c6baa57bf Merged PR 1425609: Window function support for StdDevPop and StdDevSamp
### 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

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds support for window functions `StdDevPop` and `StdDevSamp`.

#### PR Summary
This pull request introduces support for the `StdDevPop` and `StdDevSamp` window functions in the aggregation framework.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c`: Added handlers for `$stdDevPop` and `$stdDevSamp` window aggregation operators.
- `gateway/managed/Tests.Integration.Shell.Postgres/60_postgres_10260.csv` and `70_postgres_10260.csv`: Updated test results to reflect the support for the new window functions.
2024-09-12 13:51:02 +03:00
Parag Jain fb4b29be9e Merged PR 1454613: [OSS] mongo_error header file validation
### 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
mongo_errors.h should not be part of oss.

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request updates the validation script and replaces `mongo_errors.h` with `helio_errors.h` in various source files.
- `/scripts/validate_helio_extension_state.sh`: Added header file validation and updated `CheckNoMongoErrorCodes` function to include a header validation flag.
- Replaced `#include "utils/mongo_errors.h"` with `#include "utils/helio_errors.h"` in multiple source files including `shard_colocation.c`, `cluster_operations.c`, `distributed_hooks.c`, `sharding.c`, and several files in the `vector` directory.
2024-09-12 13:51:02 +03:00
Parag Jain 5e8554b3c6 Merged PR 1454140: [OSS] Port more error codes to OSS
### 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

[OSS] Port more error codes to OSS

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request ports error codes from MongoDB-specific codes to Helio-specific codes in the OSS project.
- `bson_json_schema_tree.c`: Replaced `Mongo` error codes with `ERRCODE_HELIO` equivalents.
- `bson_json_schema_validator.c`: Updated error code references to `ERRCODE_HELIO`.
- `collection.c`, `index.c`, `bson_gin_core.c`, `bson_gin_entrypoint.c`, `bson_gist_geospatial.c`, `bson_hashed_gin.c`, `bson_text_gin.c`, `gin_index_term.c`, `index_support.c`, `rum_exclusion.c`: Changed error code includes from `mongo_errors.h` to `helio_errors.h`.
- Removed `mongo_errors.h` include from `bson_gin_elemmatch.c`.
2024-09-12 13:51:02 +03:00
Ayush Saluja 102ab33b99 Merged PR 1452980: Fixup error code for invalid path in findAndModify
### 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

adding check for changing error code

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to correct the error code returned by the `findAndModify` operation.

#### PR Summary
This pull request addresses the issue where the `findAndModify` operation returns the wrong error code.
- `oss/pg_helio_api/src/update/bson_update_operators_workflow.c`: Changed the error code from `ERRCODE_HELIO_BADVALUE` to `MongoPathNotViable` when a field creation fails.

Related work items: #3463166
2024-09-12 13:51:02 +03:00
Deepak Bisht ccc656e5f0 Merged PR 1454152: Port errors for geospatial, command, index_am folders
### Does this PR have any customer impact?
No

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

### 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

Port errors for geospatial, command, index_am folders

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request updates error codes and messages in the geospatial, command, and index_am folders to use the new `ERRCODE_HELIO` format.
- `src/geospatial/bson_geospatial_geonear.c`: Replaced `MongoTypeMismatch` and `MongoBadValue` with `ERRCODE_HELIO_TYPEMISMATCH` and `ERRCODE_HELIO_BADVALUE`.
- `src/commands/create_indexes.c`: Updated various error codes to `ERRCODE_HELIO_*` equivalents.
- `src/commands/find_and_modify.c`: Changed error codes to `ERRCODE_HELIO_FAILEDTOPARSE`.
- `src/commands/create_collection_view.c`: Replaced `MongoInvalidNamespace` and `MongoInvalidOptions` with `ERRCODE_HELIO_*` equivalents.
- `include/geospatial/bson_geospatial_private.h`: Updated include from `utils/mongo_errors.h` to `utils/helio_errors.h`.
2024-09-12 13:51:02 +03:00
Parag Jain 2e0b88d293 Merged PR 1453931: Enabling GUC merge across DB
### 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
Enabling merge across DB
Now we have Citus 12.1.5 in the prod which has the fix to support merge across DB so enabling it.

----
#### AI description  (iteration 1)
#### PR Classification
Configuration change to enable a feature.

#### PR Summary
This pull request enables the merge across databases feature by default.
- `oss/pg_helio_api/src/helio_api_init.c`: Changed `DEFAULT_ENABLE_MERGE_ACROSS_DB` from `false` to `true`.
2024-09-12 13:51:02 +03:00
Lusen Dong a45694828a Merged PR 1416932: [Feature] window operator $integral and $derivative
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
UDF
### 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))

### Description
add a window operator, $integral

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds a new window operator `$integral` for aggregation.

#### PR Summary
This pull request introduces the `$integral` window operator to compute integrals using the trapezoidal rule in BSON aggregation.
- Added `BsonIntegralAggState` structure and related functions in `bson_aggregates.c` to handle integral calculations.
- Implemented `HandleDollarIntegralWindowOperator` in `bson_aggregation_window_operators.c` to process the new `$integral` operator.
- Updated SQL UDFs in `group_aggregates_support--latest.sql` and `group_aggregates--latest.sql` to include the new `bson_integral_transition` and `bson_integral_final` functions.
- Added `BsonIntegralAggregateFunctionOid` in `metadata_cache.c` and `metadata_cache.h` for function OID retrieval.
- Exposed `GetDecimal128FromInt64` in `decimal128.c` and `decimal128.h` for converting integers to BSON decimal128 format.

Related work items: #3343290
2024-09-12 13:51:02 +03:00
Deepak Bisht 68f0438c85 Merged PR 1436133: $densify aggregation stage
### Does this PR have any customer impact?
No

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

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

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

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

### Description
$densify stage is implemented with all 3 modes
- range
- partition
- full

All 7 functional tests are passing, few tests which are explain specific will be pass in next PR with the changes

![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1436133/attachments/image.png)

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds a new `$densify` aggregation stage.

#### PR Summary
Introduces the `$densify` aggregation stage to create new documents where certain field values are missing.
- Added detailed documentation for `$densify` in `docs/pgmongo/design_docs/data_plane/aggregation_stages/densify.md`.
- Implemented core aggregation logic in `oss/pg_helio_api/src/aggregation/bson_densify.c`.
- Created SQL functions and aggregates for densify operations in `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--1.21-0.sql` and `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--latest.sql`.
- Updated versioning and inclusion of new SQL files in `oss/pg_helio_api/sql/pg_helio_api--1.20-0--1.21-0.sql` and `pgmongo/sql/pgmongo--1.20-0--1.21-0.sql`.

Related work items: #3436236
2024-09-12 13:51:02 +03:00
Ujjwal Agrawal 213287f350 Merged PR 1408344: $top(N)/$bottom(N) accumulator operators implementation
### Does this PR have any customer impact?
Yes

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

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

### 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))

### Description

$top, $topN, $bottom, $bottomN implementation for $group and $setWindowFields
----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added support for `$topN` and `$bottomN` group expression operators.

#### PR Summary
This pull request introduces the `$topN` and `$bottomN` group expression operators to the aggregation pipeline.
- `bson_aggregation_pipeline.c`: Added `ParseInputDocumentForTopAndBottom` function to parse input documents for `$topN` and `$bottomN` operators, and integrated it into the existing aggregation handling logic.
- `mongo_errors.h`: Defined new error codes for handling errors related to the new operators.

Related work items: #2151574, #2151576, #2151596, #2151597, #2988406, #2988407, #2988413, #2988415
2024-09-12 13:51:02 +03:00
Deepak Bisht 82bd3295f7 Merged PR 1452704: Fix IsNan and IsInfinity for decimal128
### 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

Fix IsNan and IsInfinity for decimal128

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for handling `IsNan` and `IsInfinity` functions for `decimal128` type.

#### PR Summary
This pull request fixes the `IsNan` and `IsInfinity` functions to correctly handle `decimal128` values.
- `oss/pg_helio_core/src/query/bson_compare.c`: Updated `IsBsonValueNaN` and `IsBsonValueInfinity` to use specific checks for `decimal128`.
- `oss/pg_helio_core/src/types/decimal128.c`: Modified `IsDecimal128Infinity` to return the sign of infinity.
- `oss/pg_helio_core/include/types/decimal128.h`: Updated function signature for `IsDecimal128Infinity` to include a boolean for positive infinity.
2024-09-12 13:51:02 +03:00
Ujjwal Agrawal 6d86e18151 Merged PR 1434207: $shift operator for $setWindowFields
### 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

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added support for `$shift` operator in `$setWindowFields`.

#### PR Summary
This pull request introduces the `$shift` operator for window functions in BSON aggregation, along with additional rank-based window functions.
- Added `HandleDollarShiftWindowOperator` and related functions in `bson_aggregation_window_operators.c` to handle the `$shift` operator.
- Implemented `bson_rank`, `bson_dense_rank`, and `bson_shift` functions in `bson_aggregation_window_functions.c`.
- Added integration tests for rank-based window functions in `custom_rank.js`.
- Updated `bson_aggregation_pipeline_stage_setWindowFields.sql` with tests for `$rank` and `$denseRank` accumulators.
- Added OID lookup functions for new BSON window functions in `metadata_cache.c`.
2024-09-12 13:51:02 +03:00
Duan Pei✨ e0cd9853fc Merged PR 1405758: [Feature] $toHashedIndexkey operator implementation
### 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

https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/
2024-09-12 13:51:02 +03:00
Parag Jain 7740a1f014 Merged PR 1439695: [Feature] $out aggregation stage
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### 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))

### Description
support for $out aggregation stage in aggregation pipeline

what we not support :
1. On Mult coordinator setup source and target can not be same

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request introduces the `$out` aggregation stage to the aggregation pipeline.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_output_pipeline.c`: Added `HandleOut` function to handle the `$out` stage, including parsing, validation, and query mutation for outputting results to a specified collection.

Related work items: #1798580
2024-09-12 13:51:02 +03:00
Jayanta Mondal a511a8c252 Merged PR 1443760: [engine] collator cache, and support for $in with collation , $lookup with collation
### Does this PR have any customer impact?
Yes

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

### 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))

### Description

1. Introduces a backend process level collator cache so that we open a collator for a specific collation string once per backend process
2. Uses collation-based sort key generation for string for supporting $in which uses Hashmap for membership check. We wanted the keys of the HashMap to be collation-aware for UTF8 keys.

----
#### AI description  (iteration 1)
#### PR Classification
Code enhancement to improve collation handling in string comparison.

#### PR Summary
This pull request refines the string comparison logic using ICU collation in the `bson_compare.c` file.
- `bson_compare.c`: Replaced custom ICU collator creation with `ucol_open` and added error handling for unsupported collations. Closed the collator after use to prevent resource leaks.
- `bson_compare.c`: Added a reference to the ICU documentation for better clarity.

Related work items: #3412412, #3431062, #3456172
2024-09-12 13:51:02 +03:00
Jinrui Zhang 505f288935 Merged PR 1450431: Fix an issue that range window is not correct for shard collection
### Does this PR have any customer impact?
It fix a bug when using $setWindowFields with range window for shard collection.

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

### 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))
N/A

### Description
Fix a bug that range window is not processed correctly when using $setWindowFields.

#### How to reproduce
See this case to reproduce it:
```
SELECT mongo_api_v1.insert_one('db', 'collShard', '{ "_id":1, "y": 1, "v": 1}', NULL);
SELECT mongo_api_v1.insert_one('db', 'collShard', '{ "_id":2, "y": 3, "v": 1}', NULL);

SELECT mongo_api_v1.shard_collection('db', 'collShard', '{ "_id": "hashed" }', false);

SELECT document FROM mongo_catalog.bson_aggregation_pipeline('db', '{ "aggregate": "collShard", "pipeline": [ { "$setWindowFields": {"sortBy": { "y": 1 }, "output": { "count": { "$count": {}, "window": { "range": [ -1, 0 ] } } } } }, { "$unset": "_id" } ]}');
```

Result:
```

postgres=# SELECT document FROM mongo_catalog.bson_aggregation_pipeline('db', '{ "aggregate": "collShard", "pipeline": [ { "$setWindowFields": {"sortBy": { "y": 1 }, "output": { "count": { "$count": {}, "window": { "range": [ -1, 0 ] } } } } }, { "$unset": "_id" } ]}');
                                             document
--------------------------------------------------------------------------------------------------
 { "y" : { "$numberInt" : "1" }, "v" : { "$numberInt" : "1" }, "count" : { "$numberInt" : "0" } }
 { "y" : { "$numberInt" : "3" }, "v" : { "$numberInt" : "1" }, "count" : { "$numberInt" : "0" } }
(2 rows)

```

#### How to fix
In above case, the result for $count is not correct. It is becuase the WindowClause's parameter `isRangeAsc` is `false` by default.

In unshard collection, the `isRangeAsc` will be set during `transformWindowDefinitions()`. But for shard collection, it does not.

And on the other hand, for $setWindowFields, if a range window is applied, only ASC order is allowed. Thus, we can set `windowClasue->isRangeAsc` to `true` when processing range window cases.

#### After fix
![image.png](https://msdata.visualstudio.com/ba574a88-a171-48e0-8fcb-5fef6d23739c/_apis/git/repositories/501a5e7e-ffdc-4d1e-a5e6-910f73c6eb9a/pullRequests/1450431/attachments/image.png)

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to correct the range window for shard collection.

#### PR Summary
This pull request fixes a bug where the range window was not correctly set for shard collections.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c`: Ensured range-based bounds require an ascending `sortBy` by setting `inRangeAsc` and `inRangeNullsFirst` to true.
- `pgmongo/src/test/regress/sql/bson_ag...
2024-09-12 13:51:02 +03:00
Deepak Bisht 0d781a6e5a Merged PR 1451672: Add bson number divide API
### Does this PR have any customer impact?
No

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

### 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
Add Number divide API.

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
Introduces a new API for dividing BSON values, handling both decimal and double types, and ensuring division by zero is properly managed.
- Added `DivideBsonValueNumbers` function in `oss/pg_helio_core/src/io/pgbson_utils.c` to perform division on BSON values.
- Updated `oss/pg_helio_core/include/io/bsonvalue_utils.h` to declare the new `DivideBsonValueNumbers` function.
2024-09-12 13:51:02 +03:00
Deepak Bisht b44fe22c41 Merged PR 1450166: Enable $setWindowFields stage by default for 1.22
### Does this PR have any customer impact?
No

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

### 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))

### Description
Enable $setWindowFields stage by default

----
#### AI description  (iteration 1)
#### PR Classification
Enable `$setWindowFields` stage by default for version 1.22.

#### PR Summary
This pull request enables the `$setWindowFields` stage by default in the configuration for version 1.22.
- Modified `scripts/utils.sh` to remove the manual enabling of `helio_api.enableStageSetWindowFields`.
- Updated `oss/internal/pg_helio_distributed/src/test/regress/postgresql.conf` and `pgmongo/src/test/regress/postgresql.conf` to remove redundant enabling of `helio_api.enableStageSetWindowFields`.
- Changed `oss/pg_helio_api/src/helio_api_init.c` to set `DEFAULT_ENABLE_STAGE_SET_WINDOW_FIELDS` to `true` by default.
2024-09-12 13:51:02 +03:00
Vinod Sridharan 18eede0c08 Merged PR 1451291: [OSS] Port more error codes to OSS
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### 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))

### Description
- Port more error codes to OSS
- Disallow new backend tests in pgmongo

----
#### AI description  (iteration 1)
#### PR Classification
Porting additional error codes to the open-source version.

#### PR Summary
This pull request ports more error codes to the open-source version and updates related test cases and error handling.
- Added multiple SQL test files in `/pgmongo/src/test/regress/pgmongo_test_baseline`.
- Updated error codes in `commands_create_index_geospatial.out` and `and3.out` test files.
- Modified error handling in `oss/pg_helio_api/src/collation/collation.c` to use new error codes.
- Adjusted error logging in `oss/pg_helio_api/src/commands/insert.c` to include SQL state.
2024-09-12 13:51:02 +03:00
Lucas Borges Fernandes 6a0164ff9c Merged PR 1442384: Index truncation tests and fixes
### Does this PR have any customer impact?
No.

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

### 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))

### Description
Adding tests for index truncation on missing bson types.

Bugfixes:
1- Off by one error when truncating nested documents.
2- Missing bson type code truncation logic for nested entries.

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added tests for BSON index truncation.

#### PR Summary
This pull request introduces new tests to verify BSON index truncation behavior for various BSON data types.
- Added `bson_index_truncation_binary_tests.sql` to test binary BSON data.
- Added `bson_index_truncation_code_tests.sql` to test code BSON data.
- Added `bson_index_truncation_symbol_tests.sql` to test symbol BSON data.
- Modified `gin_index_term.c` to adjust term truncation logic.
- Updated `bson_schedule` to include new test files.

Related work items: #3412472
2024-09-12 13:51:02 +03:00
Vinod Sridharan c1e2dcba6c Merged PR 1450846: Port more errors to helio errors
### Does this PR have any customer impact?
No

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

### 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))

### Description
Port more errors to helio for more folders.

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to port error codes to Helio-specific error codes.

#### PR Summary
This pull request updates various error codes from Mongo-specific to Helio-specific error codes across multiple files.
- `vector_index_kind_impl.c`: Replaced `MongoBadValue` and `MongoFailedToParse` with `ERRCODE_HELIO_BADVALUE` and `ERRCODE_HELIO_FAILEDTOPARSE`.
- `shard_colocation.c`: Updated error codes from `MongoCommandNotSupported`, `MongoBadValue`, and `MongoFailedToParse` to Helio-specific equivalents.
- `bson_update_operators.c`: Changed error codes like `MongoTypeMismatch` and `MongoBadValue` to `ERRCODE_HELIO_TYPEMISMATCH` and `ERRCODE_HELIO_BADVALUE`.
- `parse_error.h`: Replaced `MongoTypeMismatch` with `ERRCODE_HELIO_TYPEMISMATCH`.
- `collection.c`: Updated error codes from `MongoBadValue` and `MongoInvalidNamespace` to Helio-specific equivalents.
2024-09-12 13:51:02 +03:00
Vinod Sridharan 3d3298c4b2 Merged PR 1448867: Move to helio errors in helio core
### Does this PR have any customer impact?
No

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

### 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))

### Description
Move to helio error codes in pg-helio-core

Enforce hygiene in helio core

Move to helio errors

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request refactors error handling by replacing Mongo-specific error codes with Helio-specific error codes and updates error messages accordingly.
- Added `CheckNoMongoErrorCodes` function in `/scripts/validate_helio_extension_state.sh` to ensure no Mongo-specific error codes are used.
- Updated error codes and messages in `oss/pg_helio_core/src/query/bson_compare.c` to use Helio-specific codes.
- Modified error handling in `oss/pg_helio_core/src/types/pcre_regex.c` to replace Mongo error codes with Helio error codes.
- Replaced Mongo error codes with Helio error codes in `oss/pg_helio_core/src/io/pgbsonsequence.c`.
- Updated error codes in `oss/pg_helio_core/src/types/decimal128.c` to use Helio-specific codes.
2024-09-12 13:51:02 +03:00
Ayush Saluja 5bec50ce04 Merged PR 1434519: Adding support for $document Number
### 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
This pr is forked from $rank and $denseRank pr.

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adding support for `$documentNumber` in BSON aggregation.

#### PR Summary
This pull request introduces support for the `$documentNumber` window aggregation operator in BSON, along with `$rank` and `$denseRank` operators.
- `bson_aggregation_window_operators.c`: Added handlers for `$rank`, `$denseRank`, and `$documentNumber` window operators.
- `metadata_cache.c`: Added OID retrieval functions for the new BSON window functions.
- `bson_aggregation_window_functions.c`: Implemented the window functions for `$rank`, `$denseRank`, and `$documentNumber`.
- `window_aggregate_support--1.21-0.sql`: Created SQL functions for the new BSON window operators.
- `bson_aggregation_pipeline_stage_setWindowFields.sql`: Added test cases for the new window operators.
2024-09-12 13:51:02 +03:00
Gledis Zeneli 34097e275b Fix Static Checks Pipeline (#52)
Fix PoliCheck
2024-09-09 11:04:19 +03:00
Murat Tuncer 609da18acb Update regression test defines 2024-09-05 18:18:23 +03:00
Jinrui Zhang ffe78264e1 Merged PR 1412059: implementation of $LinearFill and $locf for $setWindowFields
This PR is used for implementation of `$linearFill` and `$locf` for `$setWindowFields`. It includes:

1) The design doc for $linearFill and $locf
2) The implementation of $linearFill and $locf for verification purpose.

The detailed design and implementation could be refered in the design docs:

[$linearFill](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1412059?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_operators/linearfill.md),

[$locf](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1412059?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_operators/locf.md)
2024-09-05 18:18:23 +03:00
Jia Hu 👻 b36e62a18b Merged PR 1429339: [schema validation] support schema validation in insertion
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### 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))

### Description
[schema validation] support validation in insertion
Details about evaluation part is here:https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/pgmongo/pullRequest/1429339#1724674832

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds support for schema validation during document insertion.

#### PR Summary
This pull request introduces schema validation for document insertions, ensuring that documents adhere to specified schemas before being inserted into collections.
- `schema_validation.c`: Implements functions for preparing and validating documents against schema validators.
- `insert.c`: Integrates schema validation into the document insertion process.
- `bson_expr_eval.c`: Adds functions to evaluate expressions against documents for validation purposes.
- `schema_validation_insert.sql` and `schema_validation_insert.out`: Adds regression tests for schema validation during insertions.
- `SchemaValidationMetadataTests.cs`: Adds integration tests for schema validation during document insertion.
2024-09-05 18:18:23 +03:00
Murat Tuncer f93c2e0553 Merged PR 1448781: Fix typo in header guard macro definition
### Does this PR have any customer impact?
No

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

### 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))

### Description
Fix typo in header guard macro definition that causes build warnings and multiple inclusions of the header file.

WKBBUfferITERATOR_H was replaced by WKBBufferITERATOR_H

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix

#### PR Summary
This pull request fixes a typo in the header guard macro definition.
- `include/geospatial/bson_geospatial_wkb_iterator.h`: Corrected the macro definition from `WKBBUfferITERATOR_H` to `WKBBufferITERATOR_H`.
2024-09-05 18:18:23 +03:00
Duan Pei✨ aceb3a89e8 Merged PR 1418208: [Feature] $expMovingAvg implementation
### 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

----
#### AI description  (iteration 1)
#### PR Classification
New feature implementation.

#### PR Summary
This pull request introduces the `$expMovingAvg` aggregation operator to calculate the exponential moving average of numeric values.
- Added new aggregate functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates--1.19-0.sql` for BSON data types.
- Implemented supporting functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates_support--1.19-0.sql`.
- Documented the `$expMovingAvg` operator in `docs/pgmongo/design_docs/data_plane/aggregation_operators/expMovingAvg.md`.
2024-09-05 18:18:23 +03:00
Vinod Sridharan f283346ae2 Merged PR 1448550: [Tests] Move more tests to pg_helio_distributed
### Does this PR have any customer impact?
No

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

### 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))

### Description
Add more tests from Pgmongo -> pg_helio_distributed.

Move the dollar Ops tests to pg_helio_distributed.

----
#### AI description  (iteration 1)
#### PR Classification
Test migration

#### PR Summary
This pull request migrates additional tests to the `pg_helio_distributed` module.
- Added extensive BSON dollar operations and JSON schema query tests in `pg_helio_distributed/src/test/regress/expected/bson_dollar_ops_json_schema_query_tests.out`.
2024-09-05 18:18:23 +03:00
Vinod Sridharan fd0f9482e1 Merged PR 1448276: [RBAC] Input validation for user RBAC methods
### Does this PR have any customer impact?
No

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

### 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))

### Description
Input validation for user RBAC methods

----
#### AI description  (iteration 1)
#### PR Classification
Input validation for user RBAC methods.

#### PR Summary
This pull request adds input validation to ensure that user specifications are provided for various user RBAC methods.
- `src/commands/users.c`: Added checks to ensure user specifications are not null for `create_user`, `drop_user`, `update_user`, and `get_users` methods.
2024-09-05 18:18:23 +03:00
Amit Prabhudesai a7708ab5e0 Merged PR 1446667: Move writer util to write int32 or double
### Does this PR have any customer impact?
No

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

### 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))

### Description
Move writer util to write int32 or double

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
Refactored code to move the utility for writing int32 or double values into a common function.
- Removed `WriteStatsAsIntOrDouble` function from `src/commands/coll_stats.c` and replaced its usage with `PgbsonWriterAppendInt32OrDouble`.
- Added `PgbsonWriterAppendInt32OrDouble` function to `src/io/pgbson.c`.
- Updated `pgbson_writer.h` to include the declaration of `PgbsonWriterAppendInt32OrDouble`.
2024-09-05 18:18:23 +03:00
Vinod Sridharan 52e932125d Merged PR 1446548: [Error|OSS] New Error Format & Usage
### Does this PR have any customer impact?
No

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

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

### 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))

### Description
Start using the new Helio error codes. These are of the format M0000->M0ZZZ
Convert helio_core to use M0001 for BadValue

With the new error syntax, the errmsg is the user facing error message.
Any PII Safe messages intended for the server will now be placed under errdetail_log (rather than errhint).

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Introduces a new error format and usage.

#### PR Summary
This pull request implements a new error format and updates the usage of error handling across multiple components.
- `logger_hooks.c`: Adds logic to transform client log data and ensure error details are properly set.
- `PostgresMongoResultExtensions.cs`: Refactors error handling to include sanitized error hints and details.
- `error.rs` and `pg.rs`: Adds support for known PostgreSQL error codes and refines error handling.
- `PostgresError.cs` and `PostgresClient.cs`: Updates error properties to include error hints and details.
- Multiple files in `pg_helio_core`: Replaces `ERRCODE_INVALID_TEXT_REPRESENTATION` with `ERRCODE_HELIO_BADVALUE` for better error categorization.
2024-09-05 18:18:23 +03:00
Manish Gaur 643fc3a48d Merged PR 1446874: Version update in preparation for 1.21 release
### 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

Version update in preparation for 1.21 release

----
#### AI description  (iteration 1)
#### PR Classification
Version update in preparation for 1.21 release.

#### PR Summary
This pull request updates the version numbers and prepares the project for the 1.21 release.
- Added release notes template in `/docs/release_notes/pgmongo_1.22.md`.
- Updated version numbers in control files: `/oss/internal/pg_helio_distributed/pg_helio_distributed.control`, `/oss/pg_helio_api/pg_helio_api.control`, `/oss/pg_helio_core/pg_helio_core.control`, and `/pgmongo/pgmongo.control`.
- Added SQL migration scripts for version updates in `/oss/internal/pg_helio_distributed/sql/pg_helio_distributed--1.21-0--1.22-0.sql`, `/oss/pg_helio_api/sql/pg_helio_api--1.21-0--1.22-0.sql`, `/oss/pg_helio_core/sql/pg_helio_core--1.21-0--1.22-0.sql`, and `/pgmongo/sql/pgmongo--1.21-0--1.22-0.sql`.
- Updated SHA1 checksums for SQL scripts in `/pgmongo/sql/sha1/`.
2024-09-05 18:18:23 +03:00
Murat Tuncer 3b5331c8b1 Merged PR 1443665: Fixes sql tests in pg_helio_api and pg_helio_distributed
No

Bugfix

No

No

Turned off cost output in one test that has different
output in PG16 vs PG15

added citus installation step to Dockerfile to make
pg_helio_distributed test to pass

----
Bug fix for SQL tests in `pg_helio_api` and `pg_helio_distributed`.

This pull request addresses issues with SQL tests by updating configurations and expected outputs.
- `/oss/.devcontainer/devcontainer.json`: Added Docker build arguments for PostgreSQL and Citus versions, and configured port forwarding.
- `/oss/pg_helio_api/src/test/regress/expected/bson_aggregation_pipeline_tests_geonear.out`: Updated expected output for `bson_aggregation_pipeline` tests to include verbose EXPLAIN output.
- `/oss/.devcontainer/Dockerfile`: Parameterized PostgreSQL and Citus versions, added locale settings, and updated package installations.
- `/oss/pg_helio_api/src/test/regress/sql/bson_aggregation_pipeline_tests_geonear.sql`: Modified SQL test to include verbose EXPLAIN output.
2024-09-05 18:18:23 +03:00
Deepak Pemmaraju 544343380d Merged PR 1446395: Adding feature counters
### 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

Adding feature counters

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request adds feature usage counters for user-related operations.
- `feature_counter.c`: Added new feature mappings for user CRUD operations.
- `feature_counter.h`: Defined new feature types for user CRUD operations and updated the maximum feature count.
- `users.c`: Integrated feature usage reporting for user create, drop, update, and get operations.
2024-09-05 18:18:23 +03:00
Cornelius Boateng 75c3b4de3b Merged PR 1445538: [Perf] Set Aggregation Ops
### 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

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement for aggregation operations.

#### PR Summary
This pull request optimizes the handling of set aggregation operations by refactoring and adding new parsing and evaluation functions.
- `src/operators/bson_expression_set_operators.c`: Added and refactored functions for parsing and evaluating `$setEquals`, `$setDifference`, `$setIsSubset`, `$anyElementTrue`, `$allElementsTrue`, `$setUnion`, and `$setIntersection` expressions.
- Introduced helper functions for parsing and evaluating set operators with variable and dual operands.

Related work items: #3444465
2024-09-05 18:18:23 +03:00
Cornelius Boateng 125a25dc27 Merged PR 1435273: [Perf] Conditional Aggregation Ops
### 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
Migrate conditional operators (`$ifNull`, `$cond`, `$switch`) to new aggregation framework and ensure correct behavior.

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement for conditional aggregation operations.

#### PR Summary
This pull request refactors and optimizes the handling of arithmetic and boolean aggregation operators to improve performance.
- `bson_expression_arithmetic_operators.c`: Refactored functions to handle pre-parsed arithmetic operations, added helper functions for single, dual, and variable operand parsing and evaluation.
- `bson_expression_boolean_operators.c`: Refactored functions to handle pre-parsed boolean operations, added helper functions for variable operand parsing and evaluation, and a unified boolean operator processing function.

Related work items: #3430332
2024-09-05 18:18:23 +03:00