mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### 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
In `db.date_from_string_on_null.aggregate(
{$project: {date: {$dateFromString: {dateString: "$missing", onNull: "$missing"}}}})` case,
type of onNull would be BSON_TYPE_EOD, which result in error "unknown BSON type code 0". Add special logic in `HandlePreParsedDollarDateFromString` to handle it.
Unit test was added as well.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
Fixes an error when the `onNull` type is `BSON_TYPE_EOD` in the `$dateFromString` operator.
- `oss/pg_documentdb/src/operators/bson_expression_date_operators.c`: Added a check to return directly if `onNull` type is `BSON_TYPE_EOD`.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_date_operators_tests.out` and `oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_date_operators_tests.sql`: Added test cases to validate the fix.