Commit Graph
419 Commits
Author SHA1 Message Date
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
Vinod Sridharan ca6d81e4c9 Merged PR 1485934: [Perf] Reduce calls to GetVectorIndexDefinitionByIndexAmOid
### 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)
No
### 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
Calls to GetVectorIndexDefinitionByIndexAmOid show up in 2% of profiles in update/insert workloads.
Fix this by only calling it if htere's index order by

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

#### PR Summary
This pull request reduces unnecessary calls to `GetVectorIndexDefinitionByIndexAmOid` to improve performance.
- `src/opclass/index_support.c`: Moved the call to `GetVectorIndexDefinitionByIndexAmOid` inside a conditional block to ensure it is only called when there is an order by clause.
- `src/opclass/index_support.c`: Removed redundant calls to `GetVectorIndexDefinitionByIndexAmOid` and adjusted the logic to set `context->hasVectorSearchQuery` appropriately.
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
Deepak Bisht 722108b788 Merged PR 1483658: [OSS] Test migration geospatial PART 10
### 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 geospatial tests to oss

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

#### PR Summary
This pull request is part of a series to migrate geospatial test files to a new directory structure for better organization.
- Moved multiple geospatial test output files from `pgmongo/src/test/regress/expected/` to `pgmongo/src/test/helio_compat/expected/` without any code changes.
2024-10-17 11:43:08 +03:00
Xiaochun Liang 3661d4ffbb Merged PR 1480961: Refactor expMovingAvg calculation
### 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
Refactor expMovingAvg calculation by using bson calculation methods in pgbson_utils.c

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

#### PR Summary
Refactored the `CalculateExpMovingAvg` function to simplify the calculation of exponential moving averages.
- `bson_aggregation_statistics.c`: Changed `CalculateExpMovingAvg` to return `void` and refactored the function to use `ArithmeticOperationFunc` for arithmetic operations.
- Removed redundant error handling and simplified the logic in `bson_exp_moving_avg`.
- Added `OperationSource_ExpMovingAvg` to `ArithmeticOperationErrorSource` enum and updated error handling accordingly.
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
Vinod Sridharan dd58525877 Merged PR 1482107: [Perf] Fix local shard pushdown not working in all cases
### Does this PR have any customer impact?
Yes

### 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
When looking at the local shard, if the collection was cached when the table was created then the local shard was never registered and those backends saw degraded perf - this fixes it.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address local shard pushdown not working in all cases.

#### PR Summary
This pull request fixes issues with local shard pushdown by ensuring proper handling of shard names and remote shard status.
- `src/metadata/collection.c`: Added `TrySetCollectionShard` function to handle shard name setting and remote status.
- `src/distribution/distributed_hooks.c`: Updated `TryGetShardNameForUnshardedCollectionCore` to return empty string instead of NULL in specific cases and added logging.
- `include/metadata/collection.h`: Added `isShardRemote` field to `MongoCollection` struct.
- `include/api_hooks.h`: Updated documentation for `TryGetShardNameForUnshardedCollection` to reflect new return values.
- `src/commands/aggregation_commands.c`: Minor change to use `DatumGetTextPP` instead of `DatumGetTextP`.
2024-10-17 11:43:08 +03:00
Vinod Sridharan 24d78660f1 Merged PR 1469696: [RBAC] Support per command
### 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

Per command rbac

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

#### PR Summary
This pull request introduces per-command role-based access control (RBAC) for MongoDB commands executed through PostgreSQL.
- Added `pgmongo_run_command_as_user` and `pgmongo_run_query_as_user` functions in the new file `pgmongo/src/infrastructure/command_funcs.c` to handle command execution with user roles.
- Updated `PostgresClientProvider.cs` to build client options for user and system contexts.
- Modified `PostgresClient.cs` to include user context in command execution and added `GetFirstPageCoreAsUserAsync` method.
- Enhanced `oid_cache.c` to cache OIDs for new MongoDB commands.
- Refactored command execution in `PostgresClient.cs` to use the new RBAC functions.

Related work items: #3531096
2024-10-17 11:43:08 +03:00
Parag Jain 5ac55fcfb9 Merged PR 1481325: [OSS] Test migration part 8 [5 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
[OSS] Test migration part 8 [5 tests]

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

#### PR Summary
This pull request continues the migration of tests by removing an obsolete test file.
- Deleted `pgmongo/src/test/regress/sql/bson_index_truncation_index_tests.sql`
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
Gledis Zeneli d71209bd01 Add policheck to sync pipeline for now (#69)
Add policheck to the sync pipeline for now
2024-10-10 17:38:49 +03:00
Parag Jain 45b6958171 Merged PR 1479514: [Cleanup] : "helio_api_internal" to HelioApiInternalSchemaName
### 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
[Cleanup] : "helio_api_internal" to ApiMainInternalSchemaName

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

#### PR Summary
This pull request refactors the code by introducing a new variable `ApiMainInternalSchemaName` to replace hardcoded instances of "helio_api_internal".
- `metadata_cache.c`: Added `ApiMainInternalSchemaName` and replaced hardcoded "helio_api_internal" with the new variable.
- `delete.c`, `insert.c`, `update.c`: Updated SQL queries to use `ApiMainInternalSchemaName` instead of hardcoded schema name.
- `current_op.c`, `mongo_query_operator.c`: Replaced hardcoded "helio_api_internal" with `ApiMainInternalSchemaName`.
- `metadata_cache.h`: Declared the new variable `ApiMainInternalSchemaName`.
2024-10-10 11:17:14 +03:00
Zinan Ren 🐾 5a91bdffbc Merged PR 1438545: [Vector Search][DiskANN Part 4 - Backend] Add diskann index to pgmongo
### 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: Add DiskANN index support to pgmongo for vector search.

#### PR Summary
This pull request introduces DiskANN index support to the pgmongo backend, enabling efficient vector search capabilities.
- Added extensive SQL tests for DiskANN index creation, parameter validation, and search operations in `bson_aggregation_pipeline_tests_vector_diskann.sql`.
- Implemented new test cases in `SearchTests.cs` to validate DiskANN index functionality, including index creation, search operations, and error handling.
- Updated expected output in `bson_aggregation_pipeline_tests_vector_prefilter.out` to reflect new DiskANN index tests and results.
2024-10-10 11:17:14 +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
Xiaochun Liang d067ae67d0 Merged PR 1456850: refactor variance and covariance calculation
### 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 and refactor.

#### PR Summary
This pull request refactors the calculation of variance and covariance to improve code readability and maintainability.
- `src/aggregation/bson_aggregation_statistics.c`: Replaced multiple instances of `Decimal128` operations with more generic `BsonValue` operations, simplifying the code and reducing redundancy.
- Improved handling of different numeric types (e.g., `INT64`, `DOUBLE`) for various calculations.
- Consolidated error handling for arithmetic operations to use more consistent and descriptive macros.
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
Vinod Sridharan d3b352e197 Merged PR 1478219: [Perf] Improve perf in the cursor generation
### 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)
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
Only generate cursorId if the query has a continuation. (seen to take ~2% backend CPU of a ycsb read workload).

Also remove some functions that are long deprecated.

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement

#### PR Summary
This pull request aims to improve performance in cursor generation by removing deprecated functions and related tests.
- Removed deprecated cursor-related functions from `oss/pg_helio_api/src/commands/cursors.c`.
- Deleted test files `pgmongo/src/test/regress/expected/pgmongo_get_cursor_page_tests.out` and `pgmongo/src/test/regress/sql/pgmongo_get_cursor_page_tests.sql`.
- Updated `pgmongo/src/test/regress/expected/bson_aggregation_stage_merge_tests.out` to reflect changes in cursor ID handling.
- Added deprecation error messages for cursor-related functions in `pgmongo/src/function_stubs.c`.
2024-10-10 11:17:14 +03:00
Deepak Bisht 42e8635a15 Merged PR 1476107: Retry Lost path at the GW
### 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))
- Retries the `Lost Path` error at the GW

### Description
retry lost path error at GW

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to handle "Lost Path" errors at the gateway.

#### PR Summary
This pull request addresses the issue of "Lost Path" errors by updating error handling to retry operations at the gateway.
- `/oss/pg_helio_api/src/commands/commands_common.c`: Added logic to detect "Lost Path" errors and update the error message and code to prompt a retry at the gateway.
- `/gateway/managed/Mongo.Postgres.Runtime/PostgresClient.cs`: Added handling for the new internal error code "M0000" to recognize and retry operations when an invalid/lost index path is detected.
2024-10-10 11:17:14 +03:00
Murat Tuncer 1147fb8042 Fix sql test make check run (#67)
Started running regression tests for multiple ubuntu and pg versions
tested os: ubuntu20.04, ubuntu22.04
tested pg : 15, 16

it revealed a test failure at pg_helio_distributed extension tests,
should be fixed soon
2024-10-04 19:32:05 +03:00
Vinod Sridharan 9cc8055eff Merged PR 1474463: [OSS] Split error mapping for Helio and wire protocols
### 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?

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

### Description
Move Error map reference into a helio and mongo set of values. This splits error mapping to helio and error for other implementations like mongo wire protocol.

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

#### PR Summary
This pull request moves the error map reference to a generated folder, cleaning up the source directory.
- Removed Mongo error code definitions from `oss/pg_helio_core/include/utils/helio_errors.h`.
- Added `oss/pg_helio_core/generated/include/utils/helio_error_conversion.h` with Mongo error code definitions.
- Updated `oss/scripts/generate_error_values.sh` to handle the new generated header file.
- Moved `oss/pg_helio_core/src/utils/helio_errors.c` to `oss/pg_helio_core/generated/src/utils/helio_error_conversion.c`.
- Updated `pgmongo/Makefile` to include the new generated directory in the build process.

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

#### PR Summary
This pull request moves the error map reference to a generated folder, separating it from the source directory.
- `oss/pg_helio_core/include/utils/helio_errors.h`: Removed Mongo error code definitions.
- `oss/pg_helio_core/generated/include/utils/helio_error_conversion.h`: Added new file for Mongo error code definitions.
- `oss/scripts/generate_error_values.sh`: Updated script to generate new header and source files for error conversion.
- `pgmongo/Makefile`: Updated include paths to reference the new generated directory.
- Moved `oss/pg_helio_core/src/utils/helio_errors.c` to `oss/pg_helio_core/generated/src/utils/helio_error_conversion.c` without code changes.
2024-10-03 10:48:48 +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
Cornelius Boateng 80077a901c Merged PR 1459965: [Perf] String 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 string aggregation operations.

#### PR Summary
This pull request refactors and optimizes string aggregation operations, focusing on performance improvements.
- Removed redundant functions and added new parsing and handling functions for `$regexFind`, `$regexMatch`, and `$regexFindAll` in `bson_expression_string_operators.c`.
- Refactored existing string operations like `$concat`, `$toUpper`, `$toLower`, `$strLenBytes`, `$strLenCP`, `$split`, `$trim`, `$ltrim`, and `$rtrim` to use a more efficient parsing and handling framework in `bson_expression_string_operators.c`.
- Introduced helper functions for parsing and evaluating string operators with one, two, and three operands in `bson_expression_string_operators.c`.

Related work items: #3458666
2024-10-03 10:48:48 +03:00
Vinod Sridharan c0d703526a Merged PR 1473730: [OSS] Add conversion helper function from helio error codes to mongo error codes
### 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)
No

### 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
Add code generated helper function to convert helio errors to mongo error codes.

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

#### PR Summary
This pull request introduces a new helper function to convert Helio error codes to Mongo error codes.
- Added `helio_errors.c` to implement the conversion logic.
- Updated `generate_error_values.sh` to generate the new conversion file.
- Modified `Makefile` to include the new conversion file in the build process.
- Updated `helio_errors.h` to declare the new conversion function.
2024-10-03 10:48:48 +03:00
Vinod Sridharan cdc00f176d Merged PR 1472614: [AddNode] Fix up add node for distribution
### 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?
Yes

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

### Description

Fix up add node to work - after add node create table fails - fix this up - This is because the reference tables for collections aren't replicated to the new node so we can't replicate the table + create shards on that node in the same command.

Check on create table if all shards have reference tables - if not call replicate_reference_tables on create.

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

#### PR Summary
This pull request addresses an issue with node addition in a distributed system by ensuring metadata tables are properly replicated.
- `distributed_hooks.c`: Added `EnsureMetadataTableReplicatedCore` function to ensure metadata tables are replicated across nodes.
- `helio_distributed_init.c` (new file): Introduced initialization for distributed configurations, including a new GUC `EnableMetadataReferenceTableSync`.
- `pgmongo.c`: Moved read concern level definitions and configurations from `pg_helio_api` to `pgmongo`.
- `api_hooks.c`: Added `EnsureMetadataTableReplicated` function to check and replicate metadata tables.
- `create_collection_core.c` and `sharding.c`: Integrated `EnsureMetadataTableReplicated` to ensure metadata tables are handled during collection creation and sharding.
2024-10-03 10:48:48 +03:00
Parag Jain 07a4125ae5 Merged PR 1469364: [Perf] Delete directly from shard in delete one if available
### 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
Delete directly from shard in delete one if available

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

#### PR Summary
This pull request deprecates the `command_delete_one` function and refactors the deletion logic to directly delete from shards if available.
- `oss/pg_helio_api/src/commands/delete.c`: Deprecated `command_delete_one` function and refactored deletion logic to use shard-specific tables.
- `oss/pg_helio_api/src/test/regress/expected/commands_delete.out` and `oss/pg_helio_api/src/test/regress/sql/commands_delete.sql`: Removed tests for the deprecated function and updated tests to use `find_and_modify` with the remove option.
- Deleted `pgmongo/src/test/regress/expected/commands_delete.out` and `pgmongo/src/test/regress/sql/commands_delete.sql` as they are no longer needed.
2024-10-03 10:48:48 +03:00
Cornelius Boateng d5954f7381 Merged PR 1470292: [Perf] Date Aggregation Ops
### 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) 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 date aggregation operators to new aggregation framework.

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement

#### PR Summary
This pull request migrates date aggregation operators to a new framework to enhance performance.
- `src/operators/bson_expression_date_operators.c`: Refactored functions to separate parsing and execution of date part operators, added new helper functions for handling pre-parsed expressions.
- Updated function names to reflect the new parsing and execution separation.
- Improved handling of timezone application and constant expression evaluation.

Related work items: #3458680
2024-10-03 10:48:48 +03:00
Ayush Saluja d853734052 Merged PR 1460382: empty collection name check
### 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

empty collection name check

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to handle empty collection names.

#### PR Summary
This pull request adds checks to ensure that collection names are not empty, preventing invalid namespace errors.
- `src/metadata/collection.c`: Added a check to report an error if the collection name is empty.
- `src/commands/find_and_modify.c`: Added a check to report an error if the collection name is empty.

Related work items: #3463176
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
Parag Jain 1367513491 Merged PR 1470087: [OSS] Test Cleanup removing invalid schemas from 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 Cleanup removing invalid schemas from test

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to remove invalid schemas from test files.

#### PR Summary
This pull request cleans up test files by removing invalid schema names and adding validation to ensure they are not used.
- `validate_test_output.sh`: Added validation to check for invalid schema names and exit if found.
- `bson_aggregation_pipeline_stage_fill.out`, `bson_aggregation_stage_out_tests_2.out`, `bson_aggregation_pipeline_stage_fill.sql`, `bson_aggregation_stage_out_tests_2.sql`: Removed `mongo_catalog` from the search path.
- `bson_aggregation_pipeline_stage_fill.out`, `bson_aggregation_stage_out_tests_2.out` (in `pgmongo`): Adjusted search path to exclude `mongo_catalog`.
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
Cornelius Boateng 3e68960e3c Merged PR 1461259: [Perf] Objects Aggregation Operators
### 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

$mergeObjects

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

#### PR Summary
Refactors and optimizes the handling of `$mergeObjects` aggregation operator to improve performance.
- `src/operators/bson_expression_object_operators.c`: Refactored `HandleDollarMergeObjects` to `ParseDollarMergeObjects` and `HandlePreParsedDollarMergeObjects`, optimizing argument parsing and result processing.
- `include/operators/bson_expression_operators.h`: Updated function declarations to reflect the new parsing and handling methods.
- `src/operators/bson_expression.c`: Updated the operator expressions array to use the new parsing and handling functions for `$mergeObjects`.
2024-09-26 17:53:12 +03:00
Deepak Bisht 3eb64de267 Merged PR 1467661: [Cleanup][backend] Remove legacy errors and all referrences completely
### 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))
NA

### Description
remove legacy errors completely

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

#### PR Summary
This pull request removes legacy MongoDB error handling code and all related references.
- Deleted `mongo_errors.h`.
- Removed `CheckNoMongoErrorCodeHeader` function and related calls from `scripts/validate_helio_extension_state.sh`.
- Updated `error_utils.c` to remove legacy MongoDB error handling logic.
- Deleted deprecated functions from `helio_distributed_test_helpers.sql` and `pgmongo_test_helpers.sql`.
- Updated expected test outputs in `helio_distributed_test_helpers.out` and `pgmongo_test_helpers.out` to reflect the removal of deprecated functions.
2024-09-26 17:53:12 +03:00
Parag Jain e58c52b6f7 Merged PR 1466244: Enable $out stage GUC
### 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
Enable $out stage GUC

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

#### PR Summary
This pull request enables the `$out` aggregation stage by default in the system.
- Modified `oss/pg_helio_api/src/helio_api_init.c` to set `DEFAULT_ENABLE_OUT_STAGE` to `true`.
- Updated test files `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_stage_out_tests_2.out`, `oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_stage_out_tests_2.sql`, and `pgmongo/src/test/helio_compat/expected/bson_aggregation_stage_out_tests_2.out` to remove GUC enablement steps and error checks.
2024-09-26 17:53:12 +03:00
Ujjwal Agrawal bc57b427a4 Merged PR 1462597: Add apiStrict and apiDeprecationErrors to ignored spec fields
### 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 do not support apiVersion, so apiStrict and apiDeprecationErrors can be ignored for now.

----
#### AI description  (iteration 1)
#### PR Classification
Code update to support or ignore specific API parameters.

#### PR Summary
This pull request updates the code to include `apiStrict` and `apiDeprecationErrors` in the list of ignored specification fields, addressing the requirements of the linked work item.
- `commands_common.c`: Added `apiStrict` and `apiDeprecationErrors` to the `IgnoredCommonSpecFields` array.

Related work items: #3463178
2024-09-26 17:53:12 +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
Lusen Dong 2126f6688d Merged PR 1461377: Update comprehensive parse jstest
### 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

update jstest passrate

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix and enhancement for the `$derivative` stage aggregation operator.

#### PR Summary
This pull request addresses a bug and enhances the `$derivative` stage aggregation operator by handling `BSON_TYPE_DATE_TIME` and preventing division by zero errors.
- `bson_aggregation_statistics.c`: Added handling for `BSON_TYPE_DATE_TIME` in `yValueElement` and checks to prevent division by zero.
- `60_postgres_10260.csv` and `70_postgres_10260.csv`: Updated test results for `comprehensive_parse.js` from Fail to Pass.

Related work items: #2151582
2024-09-26 17:53:12 +03:00
Deepak Bisht ec6a642c49 Merged PR 1458010: update comments for setwindowfields JStests
### Does this PR have any customer impact?
no

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

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

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

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

### Description
update comments for setwindowfields JStests

----
#### AI description  (iteration 1)
#### PR Classification
Documentation update for JStests related to `setWindowFields`.

#### PR Summary
This pull request updates comments and error messages for JStests related to `setWindowFields` to provide more accurate descriptions of the failures.
- `/gateway/managed/Tests.Integration.Shell.Postgres/60_postgres_10260.csv`: Updated failure reasons for various `setWindowFields` tests.
- `/oss/pg_helio_api/src/commands/coll_stats.c`: Added validation to ensure `$collStats.count` is an empty object.
- `/oss/mongoerrors.csv`, `/oss/pg_helio_core/include/utils/helio_errors.h`, `/oss/pg_helio_core/include/utils/helio_codes.txt`: Added new error code `Location31170`.
- `/oss/pg_helio_api/src/commands/commands_common.c`: Added `apiStrict` to ignored common spec fields.
2024-09-26 17:53:12 +03:00
Parag Jain 178bd92c38 Merged PR 1462509: [OSS] Test Migration PART-3 [22 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
Migrating 22 tests to Oss. So those tests run in both.

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

#### PR Summary
This pull request removes SQL test files related to BSON aggregation and order aggregates as part of the test migration process.
- Deleted `bson_aggregation_trigonometric_operators_tests.sql` containing tests for various BSON trigonometric operators.
- Deleted `bson_order_aggregates_tests.sql` containing tests for BSON order aggregates and related functions.
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
Parag Jain 1b85d0ac80 Merged PR 1461213: [OSS] Test Migration PART-2 [11 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
Test Migration PART-2

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

#### PR Summary
This pull request removes test cases related to BSON aggregation arithmetic operators and expression variables as part of the test migration process.
- Removed all test cases from `pgmongo/src/test/regress/sql/bson_aggregation_arithmetic_operators_tests.sql`.
- Removed all expected output from `pgmongo/src/test/regress/expected/bson_aggregation_expression_variable_tests.out`.
2024-09-19 20:36:13 +03:00
Vinod Sridharan 98a3dbe1fc Merged PR 1462312: Cleanup for internal errors from prod
### Does this PR have any customer impact?
No

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfixes
### 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?

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

### Description
Cleanup for internal errors

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup to handle internal errors more effectively in production.

#### PR Summary
This pull request enhances error handling by adding specific checks for out-of-memory errors and refining existing error messages.
- `src/commands/diagnostic_commands_common.c`: Added handling for out-of-memory errors and refined error checks for recovery conflicts.
- `PostgresClient.cs`: Added specific handling for `OutOfMemoryException`.
- `PostgresMongoResultExtensions.cs`: Added new error messages for vector dimension constraints and refined existing error messages.
2024-09-19 20:36:13 +03:00
Deepak Bisht b6e3729219 Merged PR 1461546: Geospatial Internal error fix, Self-Intersection found in Segmentize query
### Does this PR have any customer impact?
yes

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

### Description
fix TopologyException internal error while segmentizing the query for better index scans

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for handling self-intersection errors in geospatial segmentize queries.

#### PR Summary
This pull request addresses an internal error caused by self-intersections in geospatial segmentize queries by incorporating the `ST_MAKEVALID` function.
- `/oss/pg_helio_api/src/opclass/bson_gist_geospatial.c`: Updated `BaseGeoSubdivideQuery` to use `ST_MAKEVALID` with `ST_SEGMENTIZE` to ensure valid geometries.
- `/pgmongo/src/test/regress/expected/geospatial_extract_2d_geometries.out` and `/pgmongo/src/test/regress/sql/geospatial_extract_2d_geometries.sql`: Added tests to validate the fix, demonstrating the use of `ST_MAKEVALID` to correct invalid geometries created by `ST_SEGMENTIZE`.

Related work items: #3494552
2024-09-19 20:36:13 +03:00
Parag Jain 9296b0e0cf Merged PR 1459551: [OSS] Test Migration PART-1 [28 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-1

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

#### PR Summary
This pull request adds new test cases for BSON aggregation comparison operators.
- Added extensive test cases in `pgmongo/src/test/helio_compat/expected/bson_aggregation_comparison_operators_tests.out` for `$cmp`, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, and `$lte` operators.

Related work items: #3494537
2024-09-19 20:36:13 +03:00
Deepak Bisht e3dc051d47 Merged PR 1460123: min max window operator in setwindowFields
### 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))
min and max supported in $setwindowFields

### Description
Use the existing bsonmax and bsonmin aggregate functions for window operations in setwindowfields

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added min and max window operators in `setWindowFields`.

#### PR Summary
This pull request introduces the `$min` and `$max` window operators to the `setWindowFields` aggregation stage.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_window_operators.c`: Added handlers for `$min` and `$max` window operators.
- `pgmongo/src/test/regress/sql/bson_aggregation_pipeline_stage_setWindowFields.sql`: Added tests for `$min` and `$max` window operators.
- `pgmongo/src/test/regress/expected/bson_aggregation_pipeline_stage_setWindowFields.out`: Updated expected output for new tests.
- `gateway/managed/Tests.Integration.Shell.Postgres/60_postgres_10260.csv`: Updated test results to reflect support for new window operators.
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
Amit Prabhudesai 06bb0a2e36 Merged PR 1460321: Enable background index builds by default
### Does this PR have any customer impact?
Yes

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

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

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

### Description
Enable background index builds by default

----
#### AI description  (iteration 1)
#### PR Classification
Configuration change to enable background index builds by default.

#### PR Summary
This pull request enables background index builds by default to improve performance and reduce downtime during index creation.
- `TenantConfigurationBase.cs`: Changed `EnableIndexBuildBackground` default value to `true`.
- `helio_api_init.c`: Changed `DEFAULT_ENABLE_INDEX_BUILD_BACKGROUND` default value to `true`.
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✨ 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