Commit Graph
90 Commits
Author SHA1 Message Date
Shuai Tian e3dc6c889e Merged PR 1404676: stage implementation: redact
### 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, 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
Implement for stage redact

Related work items: #1798586
2025-01-15 07:48:41 +00:00
Deepak Bisht 7a674be896 Merged PR 1542122: [Part 1] Improve $lookup and $unwind aggregation stage combination when the lookup options are simple
### Does this PR have any customer impact?
No

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

### 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))
Aggregation performance pipeline optimization for $lookup and $unwind stage combination on same fields.

### Description
1. Optimize $lookup and $unwind stage combination on same field and lookup  options are simple `localField` and `foreignField`
2. Delete dead code for $lookup

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

#### PR Summary
This pull request improves the combination of `$lookup` and `$unwind` aggregation stages by removing redundant and complex code, simplifying the logic, and optimizing performance.
- Removed the `ProcessLookupCore` function and its associated logic from `bson_aggregation_nested_pipeline.c`.
- Removed the `UnwindWalkerContext` struct and related functions for optimizing `$unwind` with `ARRAY_AGG` from `bson_aggregation_nested_pipeline.c`.
2025-01-15 07:48:41 +00:00
Zinan Ren 47ec4231ba Merged PR 1543189: [OSS] Porting type/operator/schema into documentdb - part 1
### 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))

### Description

Start porting schemas for documentdb api.
Introducing API_SCHEMA_NAME_V2, API_SCHEMA_INTERNAL_NAME_V2, API_CATALOG_SCHEMA_NAME_V2

----
#### AI description  (iteration 1)
#### PR Classification
Porting type/operator/schema into documentdb.

#### PR Summary
This pull request ports various types, operators, and schemas into documentdb as part of an ongoing effort.
- `pg_documentdb/sql/documentdb--0.24-0.sql`: Created multiple schemas and included various SQL files for query functions, operators, and metadata.
- `pg_documentdb/sql/operators/bson_dollar_operators--0.16-0.sql`: Updated operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `pgmongo/sql/operators/bson_dollar_negation_operators--1.15-1.sql` and `pg_documentdb/sql/operators/bson_dollar_negation_operators--0.16-0.sql`: Changed operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `Makefile.cflags`: Added checks for new schema variables `API_SCHEMA_NAME_V2`, `API_SCHEMA_INTERNAL_NAME_V2`, and `API_CATALOG_SCHEMA_NAME_V2`.
- `pg_documentdb/sql/schema/unique_shard_path_operator_class--0.24-0.sql`: Updated operator class definitions to use `__API_SCHEMA_INTERNAL_V2__`.
2025-01-15 07:48:40 +00:00
Zinan Ren d4d61b7278 Merged PR 1543270: [OSS] Move udf files from pg_helio_api -> pg_documentdb
### 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))

### Description

Move udf files from pg_helio_api -> pg_documentdb

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

#### PR Summary
This pull request moves User Defined Function (UDF) files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated `pgmongo/sql/pgmongo--1.23-0--1.24-0.sql` to include UDFs from `pg_documentdb` instead of `pg_helio_api`.
- Modified `oss/pg_helio_api/sql/pg_helio_api--1.15-0--1.16-0.sql` to reference UDFs from `pg_documentdb`.
- Adjusted `oss/pg_helio_api/sql/pg_helio_api--1.10-0.sql` to include UDFs from `pg_documentdb`.
- Updated `scripts/validate_helio_extension_state.sh` to add validation exceptions for the moved UDF files.
- Changed `pgmongo/sql/pgmongo--1.21-0--1.22-0.sql` to reference UDFs from `pg_documentdb`.
2025-01-15 07:48:40 +00:00
Zinan Ren 1f110c4fe3 Merged PR 1542804: [OSS] Move type/operator/schema files from pg_helio_api -> pg_documentdb
### 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))

### Description

Move type/operator/schema files from pg_helio_api -> pg_documentdb
Except udf files

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

#### PR Summary
This pull request moves type, operator, and schema files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated SQL include paths in multiple `pg_helio_api` SQL files to reference `pg_documentdb` directory.
- Modified `pgmongo` SQL files to include paths from `pg_documentdb` instead of `pg_helio_api`.
- Adjusted `validate_helio_extension_state.sh` script to account for new file paths.
- Updated `Makefile` in `pg_helio_api` to include the new directory structure.
- Changed include paths in `pg_documentdb_distributed` and `pg_helio_distributed` C source files to reflect the new directory structure.
2025-01-15 07:48:40 +00:00
Vinod Sridharan 0a2f28fdff Merged PR 1537573: Enable sharding commands and rebalancer commands
### Does this PR have any customer impact?
Yes

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

### 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))
Enable shard_collection, reshard_collection, unshard_collection with more mongo options.
Moves core processing of this to the backend.

also introduces shard rebalancing APIs

### Description

Enable shard_collection, reshard_collection, unshard_collection with more mongo options.
Moves core processing of this to the backend.

also introduces shard rebalancing APIs

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

#### PR Summary
This pull request enables sharding commands for pgmongo.
- `src/sharding/sharding.c`: Added functions to handle sharding, resharding, and unsharding collections, including `ShardCollectionLegacy`, `ShardCollectionCore`, `ParseNamespaceName`, `ParseShardCollectionRequest`, `ParseReshardCollectionRequest`, and `ParseUnshardCollectionRequest`.
2025-01-15 07:48:39 +00:00
Jia Hu 778bc161e3 Merged PR 1452968: [schema validation] apply on general update
### 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?

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

### Description
apply schema validation on general update

####Comments to follow:https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/pgmongo/pullRequest/1452968#1729531108

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Schema validation applied on general update operations.

#### PR Summary
This pull request introduces schema validation for update operations, ensuring documents comply with defined schemas during updates.
- Added `command_schema_validation_against_update` function and `ValidateSchemaOnDocumentUpdate` in `schema_validation.c` to handle schema validation during updates.
- Updated `bson_expr_eval.h` to include `ExprEvalState` struct definition.
- Modified `update.c` to integrate schema validation logic into batch and single document update processes.
- Enhanced `schema_validation_insert.sql` with tests for update operations involving schema validation.
2024-11-12 18:48:09 +08:00
Lucas Borges Fernandes 179da8cded Merged PR 1499631: Scripts for unique index truncation opclass
### 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?
Yes.

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

### Description

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

#### PR Summary
This pull request introduces scripts for unique index truncation opclass and updates the extension upgrade process.
- Added `extension_upgrade_unique_index_opclass.sql` for testing unique index opclass during extension upgrades.
- Updated `upgrade_schedule` to include the new unique index opclass test.
- Added `pgmongo--1.21-0--1.21-1.sql`, `pgmongo--1.22-0--1.22-1.sql`, and `pgmongo--1.21-0--1.21-1.sql` for unique index opclass updates.
- Modified `pgmongo--1.23-0--1.24-0.sql` to include unique index opclass scripts.
- Updated SHA1 checksum files for the new and modified SQL scripts.
2024-11-04 17:14:58 +08:00
Vinod Sridharan 055383c27d Merged PR 1483236: Truncation GUC and unique part 1
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature/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?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Fix up truncation for unique indexes behind a flag.
- This is part 1 of many. This makes unique conflicts with truncation harder to hit with the hash of the untruncated value stored as a compound term with the shard_key.
- Subsequent changes should make it so that even on hash collision the values should be validated.

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

#### PR Summary
This pull request introduces support for creating unique indexes with truncation in the Helio API.
- `helio_api_init.c`: Added a new configuration `enable_large_unique_index_keys` to allow large unique index keys.
- `create_indexes.c`: Modified logic to support large unique index keys and handle truncation.
- `bson_unique_index.sql` and `bson_unique_index.out`: Added tests for creating unique indexes with and without truncation.
- `helio_distributed_test_helpers.sql` and `helio_distributed_test_helpers.out`: Added tests for native colocation settings.
- `Makefile` and related files: Added a new `check-dist-minimal` target for minimal distributed tests.
2024-11-04 17:14:58 +08:00
Shuai Tian f8c366966d Revert "HelioDB Push 2024-10-31" (#76)
Reverts microsoft/heliodb#75, redo the merge instead of squash merge
which discarded the commit history
2024-11-04 14:38:52 +08:00
69edcc3556 HelioDB Push 2024-10-31 (#75)
Co-authored-by: Deepak Pemmaraju <deepakpe@microsoft.com>
Co-authored-by: Cornelius Boateng <cboateng@microsoft.com>
Co-authored-by: Ujjwal Agrawal <uagrawal@microsoft.com>
Co-authored-by: Jia Hu 👻 <jiahu2@microsoft.com>
Co-authored-by: Jayanta Mondal <jmondal@microsoft.com>
Co-authored-by: Vinod Sridharan <visridha@microsoft.com>
2024-10-31 16:09:00 +08:00
Parag Jain 267a6bf954 Merged PR 1483724: [OSS] Test migration PART 11 [6 test]
### 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] Test migration PART 11 [6 test]

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

#### PR Summary
This pull request is part of an ongoing effort to migrate tests, specifically addressing the deletion of an outdated test file.
- Deleted `pgmongo/src/test/regress/expected/commands_create_indexes_text.out`
2024-10-17 11:43:08 +03:00
Deepak Bisht e4c8dafb54 Merged PR 1484057: [OSS] Test migration PART 12 [9 test]
### 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
Move misc tests to OSS mostly includes
- index truncation
- mongo feature counters
- libpq permissioning

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

#### PR Summary
This pull request continues the migration of tests, specifically focusing on TTL (Time-To-Live) index tests.
- Moved `bson_query_operator_in_opt.out` from `regress/expected` to `helio_compat/expected`.
- Added new test file `oss/internal/pg_helio_distributed/src/test/regress/sql/commands_create_ttl_indexes.sql` with comprehensive TTL index tests.
- Deleted `pgmongo/src/test/regress/sql/commands_create_ttl_indexes.sql`.
- Deleted `pgmongo/src/test/regress/sql/mongo_feature_counters.sql`.
2024-10-17 11:43:08 +03:00
Cornelius Boateng caf2c7834d Merged PR 1448751: [let 3/n] Let Support for $groupBy on Sharded Collections
### 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

let support for group by on sharded collections
For now, we wrap the `bson_expression_get` with a `helio_core_bson_to_bson` function

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Support for `$groupBy` on sharded collections.

#### PR Summary
This pull request introduces support for the `$groupBy` aggregation operation on sharded collections, along with various enhancements and tests for aggregation pipeline operations.
- Added new test cases in `/pgmongo/src/test/regress/sql/bson_aggregation_pipeline_tests_let.sql` to validate `$groupBy` and other aggregation operations on sharded collections.
- Introduced `helio_core_bson_to_bson` function in `/oss/pg_helio_api/src/aggregation/bson_aggregation_pipeline.c` for BSON type conversion.
- Updated metadata cache in `/oss/pg_helio_api/src/metadata/metadata_cache.c` to include OID for the new BSON conversion function.
- Created SQL scripts for BSON coercion compatibility in `/oss/pg_helio_api/sql/udfs/aggregation/bson_coercion_compat--1.22-0.sql` and `/oss/pg_helio_api/sql/udfs/aggregation/bson_coercion_compat--latest.sql`.
- Updated control files to new versions in `/oss/pg_helio_api/pg_helio_api.control`, `/oss/pg_helio_core/pg_helio_core.control`, and `/pgmongo/pgmongo.control`.
2024-10-17 11:43:08 +03:00
Parag Jain 5cc1108c87 Merged PR 1482297: [OSS] Test migration Part 9 [Text Search Rum Index Utility]
### 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
Migration of text search related functions.

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

#### PR Summary
This pull request introduces a new text search utility using RUM indexes for BSON data.
- Added `bson_dollar_text`, `bson_text_tsquery`, and `bson_text_meta_qual` functions in `sql/udfs/query/bson_dollar_text--1.24-0.sql` and `sql/udfs/query/bson_dollar_text--latest.sql`.
- Created `bson_rum_text_path_ops` operator class in `sql/udfs/rum/bson_rum_text_path_ops--1.24-0.sql` and `sql/udfs/rum/bson_rum_text_path_ops--latest.sql`.
- Added `rum_bson_single_path_extract_tsvector` and `rum_bson_text_path_options` functions in `sql/udfs/rum/bson_rum_text_path_funcs--1.24-0.sql` and `sql/udfs/rum/bson_rum_text_path_funcs--latest.sql`.
- Updated regression tests in `src/test/regress/expected/bson_index_truncation_index_tests.out` and `src/test/regress/expected/public_api_schema.out`.
- Modified `Makefile` to include the RUM extension in `src/test/regress/Makefile` and `pg_helio_api/src/test/regress/Makefile`.
2024-10-17 11:43:08 +03:00
Parag Jain c0edf1f83c Merged PR 1478629: [OSS] Test migration part 7 [6 tests]
### Does this PR have any customer impact?
NA

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

### Description
Migration of test to oss part-7 covers moslty vector releated tests.

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

#### PR Summary
This pull request migrates several test files and adds new test cases for validating collection commands.
- Moved `bson_aggregation_pipeline_tests_vector_ivf.sql` and `bson_aggregation_pipeline_tests_vector_hnsw.sql` to `oss/internal/pg_helio_distributed/src/test/regress/sql/`.
- Added new test cases in `pgmongo/src/test/helio_compat/expected/commands_validate.out` for validating collection commands.
- Added new test cases in `oss/internal/pg_helio_distributed/src/test/regress/expected/list_metadata_cursor_tests.out` for listing metadata with cursors.
- Moved `bson_aggregation_pipeline_tests_vector_ivf.out`, `bson_aggregation_pipeline_tests_vector_hnsw.out`, and `bson_aggregation_pipeline_tests_vector_mongo.out` to `pgmongo/src/test/helio_compat/expected/`.
2024-10-17 11:43:08 +03:00
Manish Gaur 2d84c72c62 Merged PR 1479642: Version update to start 1.23 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 for next release 1.23
2024-10-10 11:17:14 +03:00
Deepak Bisht 2ec1b53305 Merged PR 1476009: [OSS] Test migration part 6 [10 tests]
### 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)
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
Move more tests to oss distributedd

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

#### PR Summary
This pull request adds a new test file to validate the `create_indexes_background` function with various scenarios.
- Added `commands_create_indexes_background.out` to test different cases of index creation, including valid and invalid specifications, error handling, and unique constraints.
2024-10-10 11:17:14 +03:00
Deepak Bisht febf50e8aa Merged PR 1473095: [OSS] Test migration [23 tests]
### 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
Test migration

#### PR Summary
This pull request adds a new test file to validate the behavior of unique indexes in a distributed environment.
- Added `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_unique_index.out` to test various scenarios involving unique indexes, including creation, insertion, and constraint violations.
2024-10-03 10:48:48 +03:00
Deepak Bisht a4b0c5bc44 Merged PR 1466193: OSS test migration Part 4 [9 tests]
### 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
Move more tests to oss

This PR also moves few `mongo_catalog` and `mongo_api_v1` functions to helio
1- range operator is now moved to `helio_api_internal.@<>`
2- `helio_api_internal.collection_table` function is moved but original one is not deleted yet.
3- `helio_api_internal.bson_dollar_lookup_project` moved.
4- `mongo_api_internal.gin_bson_get_single_path_generated_terms` is now moved to `helio_api_internal.gin_bson_get_single_path_generated_terms`
5- `mongo_api_internal.gin_bson_get_wildcard_project_generated_terms` is now moved to `helio_api_internal.gin_bson_get_wildcard_project_generated_terms`

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

#### PR Summary
This pull request migrates 8 tests as part of the ongoing OSS test migration effort.
- Moved `bson_query_operator_tests_index_backcompat.out` and `bson_index_term_generation.sql` to `oss/internal/pg_helio_distributed/src/test/regress`.
- Added new test file `bson_aggregation_expression_variable_tests.out` with extensive BSON expression tests.
2024-10-03 10:48:48 +03:00
Vinod Sridharan 472d3182a5 Merged PR 1469479: [OSS] Bugfixes from OSS and Incidents
### 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)
Yes

### 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
- Invalidate Collection cache trigger was missing in OSS
- Explain should show IXScan if the index had object_id
- ErrCode 16020 should be Location16020 and not EXPRESSIONTAKESEXACTLYNARGS
- row_get_bson should be prefixed with schema.

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

#### PR Summary
This pull request addresses several bugs identified from OSS and incidents, including updates to SQL functions, error codes, and triggers.
- Added new SQL functions and triggers in `collection_metadata_functions--1.23-0.sql` and updated `collection_metadata_functions--latest.sql`.
- Modified `PostgresExplainHelper.cs` to refine the condition for reporting `COLLSCAN`.
- Updated error codes in `helio_errors.h`, `mongoerrors.csv`, and `helio_codes.txt`.
- Adjusted SQL queries in `users.c` and `create_indexes_background.c` to use `CoreSchemaName`.
- Added a new trigger in `collection_metadata--1.23-0.sql` and included it in `pg_helio_api--1.22-0--1.23-0.sql` and `pgmongo--1.22-0--1.23-0.sql`.
2024-10-03 10:48:48 +03:00
Vinod Sridharan a0ef11359c Merged PR 1463595: [AddNode|Rebalance] Part 1: Fix up schema to support rebalancing
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Start up fixes to support add node and rebalancing

- the cluster_data table didn't have a primary key - add it
- the index specs type was mismatched between current nodes and new nodes. Make them matched and handle back compat

With this at least new nodes can be added and rebalanced. After which new tables can be created.
We still cannot create tables after add node (this scenario is still broken at this point).

----
#### AI description  (iteration 1)
#### PR Classification
Schema update to support node rebalancing.

#### PR Summary
This pull request updates the schema to facilitate node rebalancing in the cluster.
- `cluster_operations.c`: Added logic to conditionally alter types and re-add primary keys based on version checks.
- `start_postgres_server.sh` and `utils.sh`: Introduced `skipRegisterWorkerNode` flag and related functions to handle inactive nodes and shard management.
- `pgmongo--1.22-0--1.23-0.sql`: Added primary key to `pgmongo_cluster_data` and conditionally altered `index_spec_type_internal`.
- `collection_indexes_metadata--1.23-0.sql`: Added new attributes to `index_spec_type_internal`.
- `pg_helio_api--1.22-0--1.23-0.sql` and `pg_helio_distributed--1.22-0--1.23-0.sql`: Included schema changes and primary key addition.
2024-09-26 17:53:12 +03:00
Manish Gaur c28a4841da Merged PR 1462717: version update to start 1.22 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 to start 1.22 release

----
#### AI description  (iteration 1)
#### PR Classification
Version update to start the 1.23 release.

#### PR Summary
This pull request updates the project version to 1.23 and includes necessary changes to support the new release.
- Added release notes for version 1.23 in `docs/release_notes/pgmongo_1.23.md`.
- Updated version numbers in control files: `pg_helio_distributed.control`, `pg_helio_api.control`, `pg_helio_core.control`, and `pgmongo.control`.
- Added SQL migration scripts for version updates in `pg_helio_distributed`, `pg_helio_api`, `pg_helio_core`, and `pgmongo`.
- Updated SHA1 checksums for SQL scripts in `pgmongo/sql/sha1/`.
2024-09-19 20:36:13 +03:00
Ujjwal Agrawal dc157bd631 Merged PR 1446886: $first(N) & $last(N) implementation for $setWindowFields stage
### 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

----
#### AI description  (iteration 1)
#### PR Classification
New feature implementation for the `$setWindowFields` stage.

#### PR Summary
This pull request implements the `$first(N)` and `$last(N)` aggregation functions for the `$setWindowFields` stage.
- Added new aggregate functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates--1.21-0.sql` for `BSONFIRST`, `BSONLAST`, `BSONFIRSTN`, `BSONLASTN`, and their sorted variants.

Related work items: #2151585, #2151587
2024-09-19 20:36:13 +03:00
Jinrui Zhang 55b25d9c55 Merged PR 1423500: Implementation of $fill stage
This PR includes two parts:

1. The design doc of $fill
2. The implementation of $fill using `rewrite` way. Refer design doc [here](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1423500?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_stages/fill.md).

3. Extract bson_expression_partition_by_fields_get() as a common method. So that, some related changes are:

     a. densify's parse stage is changed
     b. densify's unit tests is changed due to method name change
     c. densify's original method for partitionByFields is removed

**Noticed:**
This implementation is based on the impl of `$linearFill` and `$locf`.
2024-09-19 20:36:13 +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
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
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
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
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
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
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
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
Ayush Saluja ad06937fdd Merged PR 1429409: $rank and $denseRank pgmongo implementation
### Does this PR have any customer impact?
Yes
### 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 support for $rank and $denseRank setWindowFields operator

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Implementation of `$rank` and `$denseRank` functions in pgmongo.

#### PR Summary
This pull request introduces the `$rank` window function to the pgmongo implementation, enabling rank-based aggregation operations.
- Added `BsonRankFunctionOid` and `HandleDollarRankWindowOperator` in `metadata_cache.c` and `bson_aggregation_window_operators.c` respectively.
- Implemented `bson_rank` function and `RankContext` struct in `bson_aggregates.c`.
- Updated SQL scripts `window_aggregate_support--1.20-0.sql` and `window_aggregate_support--latest.sql` to include the new `bson_rank` function.
- Declared `BsonRankFunctionOid` in `metadata_cache.h`.
2024-09-05 18:18:23 +03:00
Vinod Sridharan 2d8ec7f2db Merged PR 1441131: [Helio compat] Making more compat tests pass
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Test
### 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

Making more compat tests pass
2024-08-28 16:38:56 +03:00
Xing Fan ⛳ ce4a709922 Merged PR 1412546: Window operators: $covariancePop & $covarianceSamp
### 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)
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
Implemented covariancePop & covarianceSamp for setWindowFields

----
#### AI description  (iteration 1)
#### PR Classification
Documentation

#### PR Summary
This pull request adds design documentation for the `$covariancePop` and `$covarianceSamp` aggregation operators.
- Added `covariancePop.md` detailing the specification, behavior, examples, implementation plan, and test plan for the `$covariancePop` operator.
- Added `covarianceSamp.md` detailing the specification, behavior, examples, implementation plan, and test plan for the `$covarianceSamp` operator.
2024-08-26 13:12:13 +03:00
Vinod Sridharan 76eddc46c8 Merged PR 1437491: [OSS} Port the first 4 tests to distributed
### 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))

### Description
Port 4 tests to helio_distributed and clean up the code to make them pass.

----
#### AI description  (iteration 1)
#### PR Classification
Porting initial tests to a distributed environment.

#### PR Summary
This pull request ports the first four tests to a distributed environment, ensuring that the query evaluation functions work correctly in this setup.
- Added distributed test cases for various BSON expression evaluations in `src/test/regress/expected/bson_expr_eval_tests.out`.
2024-08-26 13:12:13 +03:00
Deepak Pemmaraju 009b69d31e Merged PR 1400474: Adding code for CreateUser, GetUsers, UpdateUser and DropUser
### Does this PR have any customer impact?
It exposes a new API customers can use

### 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
Adding code for CreateUser, UpdateUser and DropUser

Related work items: #3264072, #3278392, #3292323, #3292361, #3292364, #3315917
2024-08-26 13:12:13 +03:00
Vinod Sridharan f51b8b04ec Merged PR 1433853: [OSS] Prep for porting backend distributed tests
### 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)
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
Prep for porting backend distributed tests

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup and preparation for porting backend distributed tests.

#### PR Summary
This pull request removes obsolete code and prepares the codebase for porting backend distributed tests.
- Deleted `cluster_operations.c` and `version_utils.c` from `pgmongo/src`.
- Added new functions and triggers in `helio_distributed_test_helpers.sql` and `helio_distributed_test_helpers.out` for testing.
- Updated `cluster_operations.c` in `pg_helio_distributed` to include new cluster management functions.
- Added new SQL files for cluster operations and version utilities in `pg_helio_distributed`.
- Modified `pgmongo.c` to set up global variables for distributed functions and index build queue table creation.
2024-08-26 13:12:13 +03:00
Parag Jain 90c74bcb94 Merged PR 1412316: [Feature] Merge Index Push down for join condition Part-3
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adds support for index pushdown in join conditions for the `$merge` stage in aggregation pipelines.

#### PR Summary
This pull request introduces index pushdown capabilities for join conditions in the `$merge` stage, enhancing query performance.
- `src/opclass/index_support.c`: Added support functions for index pushdown in `$merge` join filters.
- `sql/udfs/aggregation/bson_merge_functions--1.20-0.sql`: Created new SQL functions to support index pushdown and handle merge operations.
- `src/aggregation/bson_aggregation_output_pipeline.c`: Implemented functions to create join expressions and extract merge filters.
- `Tests.Postgres.CSharp/Integration/Aggregation/MergeTests.cs`: Added integration tests to verify index pushdown functionality.
- `src/metadata/metadata_cache.c`: Added function OIDs for new merge-related functions.
2024-08-16 18:24:51 +03:00
Manish Gaur 2fff0dca08 Merged PR 1424268: Version update to start pgmongo 1.20 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 to start pgmongo 1.20 release

----
#### AI description  (iteration 1)
#### PR Classification
Version update

#### PR Summary
This pull request updates the version numbers and adds release notes for the pgmongo 1.20 release.
- Added release notes in `docs/release_notes/pgmongo_1.21.md`
- Updated version numbers in `pg_helio_api.control`, `pg_helio_core.control`, and `pgmongo.control`
- Added SQL migration scripts for version updates in `pg_helio_api`, `pg_helio_core`, and `pgmongo`
- Updated table of contents in `docs/release_notes/toc.yml`
- Updated SHA1 checksums for SQL scripts in `pgmongo/sql/sha1`
2024-08-16 18:24:51 +03:00
Deepak Bisht b08ac5b39e Merged PR 1402307: Support $avg and $push in $setWindowFields stage with inverse transition
### 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?
No

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
- Add support for $avg, $push in $setWindowFields stage.
- Add inverse transition functions for $sum, $avg, $push

### Description
Add the inverse transition function for $sum, $avg and $push for optimal window aggregation.

Also for `$push` it is not currently usable in windowing because of its specific state requirement, need to add another state for window operation for `$push`
2024-08-16 18:24:51 +03:00
Xiaochun Liang 622d392bf2 Merged PR 1376029: stdDevPop and stdDevSamp accumulator for group by aggregation
### 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
Implementation of $stdDevPop and $stdDevSamp accumulators.

Reference:
[stdDevPop](https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/)
[stdDevSamp](https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/)

Related work items: #3277074
2024-08-16 18:24:51 +03:00
Vinod Sridharan f64558301b Merged PR 1411883: [Lookup with Let] Fix up some JStests for lookup with Let and misc lookup fixes
### 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?
Yes and Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
- Fix up bugs with $lookup with Let by rewriting lookup to be let friendly
- Get through jstests having lookup with let
-  Optimize Lookup where hte left and right both are on _id to support joins directly on object_id
- Allow the lookup pipeline to be split as "inlined" and "non-inlined" and allow pushing up the inlined pipeline
- Fix bugs with facet/graphlookup arising from Lookup with let tests
- Allow inlining the $unwind path after a $lookup if the $unwind matches a $lookup as (behind a feature flag)
2024-07-31 17:09:22 +03:00
Manish Gaur 65380e5677 Merged PR 1404339: pgmongo version update for 1.19 release - Round 2
### 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

pgmongo version update for 1.19 release - Round 2
2024-07-31 17:09:22 +03:00
Vinod Sridharan c4ed06beeb Merged PR 1402545: [Let] Support let in all remaining stages except $lookup
### Does this PR have any customer impact?
Not yet

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

### 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
Support remaining aggregation stages except $lookup and $mergeObjects on sorted with $group.
2024-07-31 17:09:22 +03:00
Vinod Sridharan 3cbc0e0037 Merged PR 1400815: [Let support] Add support for let in more stages
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Features
### 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))
n/a
### Description
Add support for let in
- $sortByCount
- $group (partial)
- $addFields
- $project
- $facet
- $unionWith
- $graphLookup
- $project
2024-07-31 17:09:22 +03:00
Deepak Bisht 91b9946227 Merged PR 1383926: setWindowFields 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?
No

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
- Support for `$setWindowFields` aggregation pipeline stage

### Description
This PR adds the support for `$setWindowFields` aggregation stage using the Postgres `Window aggregation` operators.

For the first PR it only adds support with `$sum` aggregation operator.
Next set of PRs will individually support all the other window aggregation operators supported by `$setWindowFields` stage.

[TODO] Currently $sum is used as is (the way $group uses it), there is way to optimize this using the `Inverse Transition` functions for Window aggregation which modifies the aggregated state in a way to accomodate rows leaving the group in a moving window, which will be done later (this is done to make review on smaller set of files)

Related work items: #2272584
2024-07-11 17:56:53 +03:00