mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) ### 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 ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description Aggregation stages which do not support collation yet: `bucket, group, setWindowFields, fill, geoNear, sortByCount` If collation is provided for an aggregation whose pipeline has any of these stages, the aggregation fails with `FEATURE_NOT_SUPPORTED` ---- #### AI description (iteration 1) #### PR Classification Code enhancement to handle unsupported aggregation stages with collation. #### PR Summary This pull request adds error handling for unsupported aggregation stages when collation is applied. - `bson_aggregation_pipeline.c`, `bson_aggregation_nested_pipeline.c`, `bson_aggregation_window_operators.c`: Added checks and error messages for unsupported collation in stages like `$bucket`, `$replaceWith`, `$geoNear`, `$fill`, `$group`, `$documents`, `$setWindowFields`, and `$sortByCount`. - `bson_dollar_ops_collation_tests_runtime.sql`: Added test cases for unsupported aggregation stages with collation. - `bson_dollar_ops_collation_tests_runtime.out`: Updated expected output to include error messages for unsupported collation in various stages. - `bson_query.h`: Refactored `IsBsonTypeCollationAware` function for better readability. - `bson_dollar_operators.c`: Simplified collation applicability check using `IsBsonTypeCollationAware`. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4022806
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/bson/bson_query.h
|
|
*
|
|
* Common declarations of functions for handling bson queries.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef BSON_QUERY_H
|
|
#define BSON_QUERY_H
|
|
|
|
|
|
#include "io/bson_core.h"
|
|
|
|
/* The function that is called when dealing with a querySpec on a leaf
|
|
* query filter (e.g. "a.b" : <value>)
|
|
*/
|
|
typedef void (*ProcessQueryValueFunc)(void *context, const char *path, const
|
|
bson_value_t *value);
|
|
typedef void (*ProcessQueryFilterFunc)(void *context);
|
|
|
|
bool TraverseQueryDocumentAndGetId(bson_iter_t *queryDocument,
|
|
bson_value_t *idValue, bool errorOnConflict,
|
|
bool *hasNonIdFields);
|
|
|
|
void TraverseQueryDocumentAndProcess(bson_iter_t *queryDocument, void *context,
|
|
ProcessQueryValueFunc processValueFunc,
|
|
ProcessQueryFilterFunc processFilterFunc,
|
|
bool isUpsert);
|
|
|
|
static inline bool
|
|
IsBsonTypeCollationAware(bson_type_t type)
|
|
{
|
|
return type == BSON_TYPE_UTF8 || type == BSON_TYPE_DOCUMENT ||
|
|
type == BSON_TYPE_ARRAY;
|
|
}
|
|
|
|
|
|
#endif
|