Commit Graph
167 Commits
Author SHA1 Message Date
Santiago Fernandez Madero d075283e14 Merged PR 1345825: [let 1/n] - Make variables part of aggregation expression data and support expressions as the variable value
### 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

Make variables part of aggregation expression data and support expressions as the variable value. Also this flows the variable context through projection tree which is needed to support lookup let and also let on update and find (top level let).

Once this is in, next PR will be to support the $let aggregation operator, which will set the variable context at parse time for it's child expressions.
2024-05-24 10:41:23 +03:00
Ayush Saluja 4025aef053 Merged PR 1344944: [pgmongo] DateFromString implemntation Part 1
### 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 aims to support $dateFromString operator.
Since this has multiple parts and complexity to it this part of the pr will take care of handling all the input strings and parsing them with the given input format and incase format is not specified we use for now Default format to parse the dateString. If not parseable we throw error.

In next set of pr we will aim to parse the string  when format is not specified with even more format checks

Related work items: #2019204
2024-05-24 10:41:23 +03:00
Xiaochun Liang 64083dd0b6 Merged PR 1337819: $sortArray (aggregation) operator
### 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
$sortArray (aggregation) operator

Related work items: #2019138
2024-05-24 10:41:23 +03:00
Ayush Saluja e2f0854313 Merged PR 1337174: [pgmongo] dateTrunc custom jstest and adding more sql tests
### Does this PR have any customer impact?

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

### 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
Fixing a bug for dateTrunc startOfweek handling and adding more sql tests
2024-05-24 10:41:23 +03:00
Duan Pei✨ 064173a3d7 Merged PR 1333172: $minN/maxN array operators
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
No
### Description
Add support for $maxN/ $minN aggregation array operator.

Related work items: #2019119, #2019127
2024-05-24 10:41:23 +03:00
Xing Fan ⛳ 20f5955f87 Merged PR 1337657: add aggregation array operator $zip
### Does this PR have any customer impact?
Yes

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

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

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

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

### Description
Add array operator: $zip

Related work items: #2019134
2024-05-24 10:41:23 +03:00
Rajesh Kumar Thandapani a781d0e3fe Merged PR 1299301: Change Stream aggregation stage implementation
### Does this PR have any customer impact?
   No. It does not have any customer impact, since the UDF is not exposed to users in this PR.

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
   Feature. It introduces infrastructure and an UDF for implementing Change Streams.

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
   Change Stream Aggergation stage UDF(change_stream_aggregation) has been added in this PR.

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
 The release notes for this feature is available here:
 docs/pgmongo/design_docs/data_plane/change_streams/change_stream_release_notes.md

### Description

### Description
This PR implements the change stream aggregation UDF `change_stream_aggregation`
 It adds some unit tests for testing change stream.

# Supported Features
    Currently, the $changeStream aggregation supports only these features:
    1) Watching a collection for the following change events:
        a) INSERT
        b) UPDATE:
            NOTE: UPDATe event always provides the new document after update.
                  The update_description field is not supported yet.
        c) DELETE
    2) Resuming the change stream from a particular event using the "_id" field in the change event
    or the "postBatchResumeToken" field in the change stream cursor.

# Current Limitations:
    1) The following events are not supported:
        a) create
        b) createIndexes
        c) drop
        d) dropDatabase
        e) dropIndexes
        f) invalidate
        g) refineCollectionShardKey
        h) rename
        i) replace: NOTE: this event is published as "UPDATE" currently.
        j) reshardCollection
        k) shardCollection

        NOTE: Expanded Events:
            The above list includes expanded events also. The option "showExpandedEvents" is not supported.

    2) Unsupported change stream pipeline options:
        All the options other than "resumeAfter" is not currently supported, and will result in an error.

        NOTE:  Hisstorical change stream events are not supported "startAtOperationTime"
        So change streams can be created from the current time only.

    3) Change Stream targets:
        Currently, $changestream aggregation can be applied at collection level only. Not at the database/cluster level. But Multiple change streams can be opened on multiple collections.
        But the current default maximum limit on parallel change streams by default is "5".

    4) Support for multi node clusters.
         Change Streams are supported only at the single node clusters.
2024-05-24 10:41:23 +03:00
Vinod Sridharan 664f510924 Merged PR 1352385: [1.16] Deployment internal error fixes
### 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))
N/A
### Description

- Fix Lookup error with _id performance fix
    - if lookup had a $sort/$group as an inner pipeline, then this would return a function not found error
- Attempt to fix spurious column needs to be in group by to be used in aggregate
- Attempt to fix $collStats errors with Cache Lookup Failed
      - Unable to repro but the error kicks in on template tuple_desc creation so ensure that the values are correct (they were incorrectly constructed). Not sure why this pops up now.
2024-05-24 10:41:23 +03:00
Vinod Sridharan 3a19bd21b0 Merged PR 1349692: Cursor changes
### Does this PR have any customer impact?
Yes

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

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

### Description
This covers a few issues uncovered in customer investigations:
1) Explain doesn't show the new $not operators and instead uses $unknown
2) For streaming cursors we can't support parallel scans since that could reorder the tuples and make us miss results. If we have a streaming cursors - remove the parallel plan altogether
3) For non-streaming cursors, always prefer index paths over parallel seqscans - this is because our statistics aren't great and on large docs (esp with LIMIT) the selectivity makes the planner think a parallel path can be faster. We can re-evaluate this with statistics later
4) For non-streaming cursors with LIMIT, allow index scans instead of bitmap scans with a GUC. This also needs to be paired with the RUM enable_semifast_gettuple - this is behind a GUC to allow for validation of correctness. Outside of LIMIT scenarios do not allow this yet.

Note: This is not yet enabled for TTL purger since we want to improve that case with an improvement inside amgettuple first.
2024-05-13 13:23:03 +03:00
Vinod Sridharan a9ce9d1c81 Merged PR 1348551: Cursor fixes: Fix non-determinism of SeqScan
### 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))

### Description
SeqScan paths aren't deterministic with large collections and caching. With Buffer caching, seqscans start in the middle and wrap around and change arbitrarily with every seqscan call.

Our cursor implementation assumes increasing order of TIDs.

Convert SeqScan to a TIDRangeScan with initial scan being >= (0,0) and subsequent calls with >= ContinuationTOken.

This also allows for us to more efficiently skip pages on getmore calls making the overall calls faster.
2024-05-13 13:23:03 +03:00
Lucas Borges Fernandes 533dc34b1a Merged PR 1347886: Moving $addToSet to 1.15-1
Adding $addToSet in 1.15-1.
Removing it from 1.14-7.
2024-05-13 13:23:03 +03:00
Lucas Borges Fernandes 51042e6473 Merged PR 1334895: AddToSet accumulator for group by aggregation stage
### Description
Implementation of the $addToSet group accumulator.

Reference: https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/

Related work items: #2988403
2024-05-13 13:23:03 +03:00
Vinod Sridharan 7625068b45 Merged PR 1343473: [Negation] Prep Negation Operators for hotfix into 1.14
### 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)
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
Prep the sql changes for hotfixing into 1.14-6
2024-05-03 13:34:41 +03:00
Javier Figueroa 01d68d4efa Merged PR 1343345: Commit 7e3533e6: Bumping schema for 1.17 release
### Does this PR have any customer impact?
No

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

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

### Description
Commit 7e3533e6: Bumping schema for 1.17 release
2024-05-03 13:34:41 +03:00
Vinod Sridharan 4bad70837f Merged PR 1341129: Enable index builds without connection limits
### 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))
N/A
### Description
Don't let citus.max_client_connections affect LibPQ connections by marking these connections as internal
2024-05-03 13:34:41 +03:00
Jayanta Mondal 7fc11c2dd8 Merged PR 1339203: Vector Index error message fix
### Does this PR have any customer impact?
No

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

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

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

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

### Description

This is a minor bug in our code that we caught during writing some release validation specs.  Existing and request indexes were flipped.
2024-05-03 13:34:41 +03:00
Jayanta Mondal fe6dd724f3 Merged PR 1337682: Text Index error code/message fix
### Does this PR have any customer impact?
May be.

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

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

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

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

### Description

Mongo allows only one text index. We also allowed once. But when someone created the second index, we said that an equivalent index exists instead of saying one can't create more than one text index.
2024-05-03 13:34:41 +03:00
Vinod Sridharan d4d9f5cda9 Merged PR 1333485: [Negation] Add support for pushdown of the $not operator sometimes
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Adds index pushdown for $not operators
### Description
Adds index pushdown for $not operators
2024-04-26 16:19:32 +03:00
Vinod Sridharan cf88b82fe7 Merged PR 1332248: Selectivity Part 1: Implement operator statistics behind a flag
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Implement statistics for bson Dollar functions behind a feature flag. This uses the default Postgres operator statistics using Most Common Value and Histogram stats if available to compute.

As a fallback it also uses operator data to provide default values if needed.

Sets up an ANALYZE function on bson so that this can be improved (since the ANALYZE is not there yet). This will be done in a subsequent change.
2024-04-26 16:19:32 +03:00
Vinod Sridharan 6da56e4c27 Merged PR 1326035: Performance fixes for nativeColocation & Shard pushdown
### Does this PR have any customer impact?
No (Behind a feature flag)

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

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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Improve perf for single node - go for the shard directly if it’s available improving single node perf.

For perf results we see
YCSB Read: 8000 reads/sec. (Up from 6300)
YCSB Update: 1745 ops/sec ( from 1550)
YCSB Insert: 1760 ops/sec (from 1550)
2024-04-26 16:19:32 +03:00
Vinod Sridharan 63b7efe545 Merged PR 1332139: [RUM] Delete non fast scan code (and other code cleanups)
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Delete the non-fast scan code since the faster scan code has been made default everywhere. Also remove some of the old CLusterVersionisAtleast() paths
2024-04-26 16:19:32 +03:00
Lucas Borges Fernandes 4d82761118 Merged PR 1328531: Ignoring returnKey parameter when set to false
### Description
TODO
2024-04-26 16:19:32 +03:00
Mehmet YILMAZ 3b71f63ea9 Update heliodb-oss-sync.yml for Azure Pipelines 2024-04-26 14:15:42 +03:00
Mehmet YILMAZ 47753dc08f Update heliodb-oss-sync.yml for Azure Pipelines 2024-04-26 13:51:01 +03:00
Tanvi Bhandari f3857be909 Merged PR 1326506: [Index Build background] Reduce default value of cron job schedule and DropIndex change
### 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)

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

### Description
1. Reduce default value of cron job schedule to 2 seconds for Index Build background feature.
    Though, the Index Build background  feature is behind GUC (disabled by-default)
2. Disable cron job for upgrade test, we have seen flakiness in the test
3. DropIndexes should be able to cancel CreateIndexes as right owner so that execution of DROP INDEX CONCURRENTLY is cleaner and it does not conflict with CREATE INDEX CONCURRENTLY

Sample serverside logs for 3rd point

```
2024-04-16 16:54:34.990 UTC [40693] LOG:  Cancel existing index build request for 6 is completed.
2024-04-16 16:54:34.990 UTC [40693] STATEMENT:  CALL mongo_api_v1.drop_indexes_concurrently($1, $2)
**2024-04-16 16:54:34.991 UTC [40704] WARNING:  CONCURRENTLY-enabled index commands can fail partially, leaving behind an INVALID index.
         Use DROP INDEX CONCURRENTLY IF EXISTS to remove the invalid index.
2024-04-16 16:54:34.991 UTC [40704] ERROR:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] HINT:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] STATEMENT:  CREATE INDEX CONCURRENTLY documents_rum_index_6 ON mongo_data.documents_1 USING pgmongo_rum ( document mongo_catalog.bson_rum_single_path_ops(path='_id'), document mongo_catalog.bson_rum_single_path_ops(path='vendorItemId'))
2024-04-16 16:54:34.991 UTC [40705] ERROR:  canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40705] HINT:  canceling statement due to user request**
2024-04-16 16:54:34.991 UTC [40705] STATEMENT:  CREATE  INDEX CONCURRENTLY  documents_rum_index_6_102045 ON  mongo_data.documents_1_102045 USING pgmongo_rum (document mongo_catalog.bson_rum_single_path_ops (path = '_id' ) ,document mongo_catalog.bson_rum_single_path_ops (path = 'vendorItemId' ) )

Related work items: #3109561
2024-04-19 12:03:52 +03:00
Santiago Fernandez Madero e8ff45b702 Merged PR 1325618: Treat path expressions as CURRENT.path as that should be the behavior
### 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)

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

### Description

CURRENT is a system variable that points to ROOT (current document) unless it is overridden, if it is overridden, path expressions should point to that value rather than ROOT, which means "$a" is equivalent to "$$CURRENT.a".

This PR changes path expressions to be `CURRENT.path` rather than just `path`.

This hasn't been a problem since we don't support $let yet, however, now that we're adding expressions that can define variables, like `$map` this showed up on JS Tests.
2024-04-19 12:03:52 +03:00
Ujjwal Agrawal 7a010db2d7 Merged PR 1304026: [Bugfix] Some self intersecting polygons don't throw error
### 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)

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

### Description

add jstest for self intersecting polygons

Related work items: #2894103
2024-04-19 12:03:52 +03:00
Ayush Saluja 808ebb466f Merged PR 1324589: [pgmongo] $dateDiff operator 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)

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

### Description

Related work items: #2019195
2024-04-19 12:03:52 +03:00
Jia Hu 👻 f7fc1d3bfd Merged PR 1315834: add array operator: $map, $reduce
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
add array operator: $map, $reduce

Related work items: #2019117, #2019128
2024-04-19 12:03:52 +03:00
Vinod Sridharan 09e47359ba Merged PR 1327595: [Lookup Hotfix] Prep for the Lookup Hotfix
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor/Hotfix
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Prep the schema for a $lookup perf hotfix.
2024-04-19 12:03:52 +03:00
Vinod Sridharan 8c7173a2d9 Merged PR 1325613: Lookup Index pushdown
### 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)

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

### Description
Lookup Index pushdown: Allow index pushdown of lookup queries for both left and right queries.
For _id joins, push to the B-tree index and use the object_id column.
For RUM indexes, introduce a new function and support that allows pushing to the index based on the specified path rather than the document itself.

This caused a customer $lookup query to go from taking 45+ mins and timing out to finishing in under 3 mins
2024-04-19 12:03:52 +03:00
Ayush Saluja 19f13d0fb9 Merged PR 1291177: [pgmongo] DateAdd datesubtract aggregation operators
### Does this PR have any customer impact?
yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
DateAdd , dateSubtract aggregation operator pr

Related work items: #2019193, #2019208
2024-04-19 12:03:52 +03:00
Deepak Bisht 58afe0aa8f Merged PR 1275776: [Pgmongo] - Part 1 GeoNear aggregation stage, add documentation and necessary operators and functions
### 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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Support $geoNear aggregation stage

### Description
Add the design doc and necessary operators and functions needed for $geoNear

Also,
1-  Implement the $geoNear aggregation stage skeleton and support all options.
     - `distanceField`,
     - `near` (both legacy, geojson point)
     -`includeLocs`,
     -`minDistance` & `maxDistance`
     - `distanceMultiplier`
     - `key`
2- Support index pushdown of the stage to `2d` and `2dspher` index.
    - spherical / non-spherical distance support for `2d` index.
    - spherical distance support for `2dsphere` index

Things still a TODO.
1- ~~Update the mongo explain plans for geonear stage~~.
2- Make the stage require an index always, currently it can be executed without index too.
3- Fix projection for nested array fields.
4- Make common test setup for running $geoNear queries in JSTests which don't require key in mongo.
5- More testing and validations with other stages that can use $geoNear.
6- Test batching and cursor support.
7- Overall testing and validations

Related work items: #3000189, #3065270
2024-04-19 12:03:52 +03:00
Ujjwal Agrawal 38ec9b877d Merged PR 1316954: Change postgis runtime matcher functions for $center
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
1.16
### Description

Use st_dwithin and st_expand for $center

Related work items: #2894556
2024-04-19 12:03:52 +03:00
Vinod Sridharan 9cc7f3e54b Merged PR 1321527: Fix up crashes in findAndModify
### Does this PR have any customer impact?
Yes

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

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
N/A
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Update was using the datum as a pointer which doesn't work when the Datum is compressed. DatumGetPgbson doesn't work here since it would decompress in the SPI context and then that would get freed on SPI_Finish().

Instead store the value as a transferred Datum and then call DatumGetPgbson() before use which decompresses it
2024-04-19 12:03:52 +03:00
Vinod Sridharan 770f2cc6af Merged PR 1319767: Estimated DocumentsCount Support
### Does this PR have any customer impact?
Yes

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

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

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Improve performance of estimatedDocumentsCount

### Description
Mongo Spec specifies that count() without any filters maps to the "estimatedDocumentsCount" that uses statistics. In pgmongo we were using the full fidelity count in this path too. Instead use collStats with documentsCount to fetch the count if there's no filters/limit/skip.
2024-04-19 12:03:52 +03:00
Mehmet Yilmaz 1151d0fcdc Merged PR 1318097: [OSS] Move coll_stats func
### 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)
UDF

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

### Description
Move coll_stats funcs to oss
2024-04-19 12:03:52 +03:00
Murat Tuncer c94b5f4d75 address comments 2024-04-15 21:47:01 +03:00
Murat Tuncer c4890451a3 Update docs 2024-04-15 21:47:01 +03:00
Jayanta Mondal 7325f8e61c Merged PR 1318440: [Bug] Overflow bug in ttl index - potential data loss
### Does this PR have any customer impact?
Yes

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

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

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

### Description

With a large TTL expireAfterSeconds when we convert to milliseconds it can overflow (which can be a negative int32) leading to deletion of data that was not expected to be deleted.
2024-04-05 13:43:51 +03:00
Vinod Sridharan 6f1ebc3957 Merged PR 1317779: [Colocation] Prep for Colocation Hotfix
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Prep to do schema hotfix for colocation. Port to 1.13 / 1.14
2024-04-05 13:43:51 +03:00
Vinod Sridharan 2da6633812 Merged PR 1314099: Colocation Support Part 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)

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

### Description
2024-04-05 13:43:51 +03:00
Ujjwal Agrawal f09e98eced Merged PR 1314512: Geospatial module code cleanup
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Code cleanup
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
NA
### Description

Cleanup dead code

Related work items: #3059119
2024-04-05 13:43:51 +03:00
Mehmet Yilmaz 2c8f9398da Merged PR 1309790: Modify ok output as double
### Does this PR have any customer impact?
No

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

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

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

### Description
MongoDB responds with "ok": float64(1), and Helio responds with "ok": int32(1)}. This PR modify count command response to simulate MongoDB response.
2024-04-05 13:43:51 +03:00
Ujjwal Agrawal d340c1951b Merged PR 1304364: [Bugfix] False +ve when $centerSphere covers points but not the shape itself
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Fixes large buffer area bug where all the points of a shape are covered by the buffer area but the shape itself is not container, we were returning false positives in this case leading to failing geo_s2within_line_polygon_sphere.js.
With this we check for intersection with the compliment area in case the buffer area is greater than hemishpere of earth. If intersection is there that means the shape lies outside buffer area so we return false.

**Note:** this will also result in perf improvement for centerSphere radius greater than pi as in that case we just return true without any recheck.

Related work items: #2992082
2024-04-05 13:43:51 +03:00
Shuai Tian 🚀 fa33a920c7 Merged PR 1310426: add timestamp operator: $tsSecond, $tsIncrement
### Does this PR have any customer impact?
Yes

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

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

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

### Description
add timestamp operator $tsSecond, $tsIncrement

Related work items: #3027168, #3027169, #3027170
2024-04-05 13:43:51 +03:00
Ayush Saluja 1a9dcdd00b Merged PR 1277272: $dateTrunc aggregation operator support
### Does this PR have any customer impact?
Yes

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

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

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

### Description
adding support for $dateTrunc mongo operator

Related work items: #2019212
2024-04-05 13:43:51 +03:00
Murat Tuncer daad5667f1 Update issue templates 2024-04-05 10:13:17 +03:00
Murat Tuncer 1b808ac66c Update issue templates 2024-04-05 09:54:10 +03:00
Deepak Bisht fb2ad03743 Merged PR 1278872: [Pgmongo][Geospatial]: Fix orientaion of polygons, and enhance multi* multi* geowithin match checks
### 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

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

### Description

This PR addresses compatibility issues between $geoWithin and ST_Covers. It aims to fix some issues and outline others that are not easily resolved at the moment.

**Issue 1**: PostGIS uses a clockwise orientation rule for polygons, where exterior rings should be oriented clockwise and hole rings should be oriented counterclockwise. This is different from the GeoJSON standard specification, which is the opposite. Therefore, we need to ensure that all our polygons follow a clockwise orientation to be modeled correctly.

Few referrence where the difference is mention:
1- https://gis.stackexchange.com/questions/306567/postgis-geojson-query-not-validating#comment496061_306571
2- https://dev.to/rodreegez/geojson-right-hand-rule-2idk

**Solution**: This PR fixes the issue by forcing polygons to follow a clockwise orientation. This resolves some cases where a polygon sharing a boundary point is considered a match in ST_Covers. Without this fix, the same polygon or any shape sharing a boundary point would not be considered a match.

**Issue 2**: For a Multi*/Multi* GeoJSON type coverage, PostGIS expects a single component to cover all the components of the other GeoJSON, which is not the behavior in Mongo.

**Solution**: This PR fixes the issue by reading individual components from Multi*/GeometryCollection GeoJSON types and calling ST_Covers for each one individually. If all components are covered by the query, it is considered a match.

**Issue 3**: The coverage of polygons with holes is faulty in PostGIS, and there is no workaround for this issue. These limitations are documented and should throw not supported error for now until we fix this in pgmongo layer.

Mongo DB also has some undefined behaviors as they don't guarantee degeneracy https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#degenerate-geometry, where the polygon doesn't guarantee to contain another polygon sharing its boundaries.

Also along with this PR the wkb iterator now follows a visitor patter in order to be reusable for other scenarios as well e.g. wkb traversing logic of $centerSphere is now also used for multi multi geowithin checks

Related work items: #2958169
2024-03-29 10:49:37 +03:00