Merged PR 1416932: [Feature] window operator $integral and $derivative

### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
UDF
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
add a window operator, $integral

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

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

Related work items: #3343290
This commit is contained in:
Lusen Dong authored and Murat Tuncer committed 2024-09-12 13:51:02 +03:00
1 parent 68f0438c85
commit a45694828a
12 files changed
+798 -7

No files matched your search

+7 -1
View File
@@ -424,6 +424,9 @@ Location5339902,5339902,419
Location5371601,5371601,454
Location5371602,5371602,455
Location5371603,5371603,456
Location5423900,5423900,481
Location5423901,5423901,482
Location5423902,5423902,483
Location5429413,5429413,420
Location5429414,5429414,421
Location5429513,5429513,422
@@ -438,6 +441,9 @@ Location5439015,5439015,430
Location5439016,5439016,431
Location5439017,5439017,432
Location5439018,5439018,433
Location5490710,5490710,484
Location5624900,5624900,485
Location5624901,5624901,486
Location5626500,5626500,434
Location5654600,5654600,435
Location5654601,5654601,436
@@ -478,4 +484,4 @@ Location6045000,6045000,70
Location6050106,6050106,459
Location6053600,6053600,478
Location6586400,6586400,479
Location8993000,8993000,480
Location8993000,8993000,480
1 ErrorName MongoError OrdinalPosition
424 Location5371601 5371601 454
425 Location5371602 5371602 455
426 Location5371603 5371603 456
427 Location5423900 5423900 481
428 Location5423901 5423901 482
429 Location5423902 5423902 483
430 Location5429413 5429413 420
431 Location5429414 5429414 421
432 Location5429513 5429513 422
441 Location5439016 5439016 431
442 Location5439017 5439017 432
443 Location5439018 5439018 433
444 Location5490710 5490710 484
445 Location5624900 5624900 485
446 Location5624901 5624901 486
447 Location5626500 5626500 434
448 Location5654600 5654600 435
449 Location5654601 5654601 436
484 Location6050106 6050106 459
485 Location6053600 6053600 478
486 Location6586400 6586400 479
487 Location8993000 8993000 480