mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 12:19:56 -05:00
### 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? Yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description More general improvements to order by and composite: Create Indexes 1) Support creating a composite index side by side with a regular index 2) Block creation of descending or wildcard and unsupported set ups for composite indexes Planner: 1) Support ordering by the Nth path of an index if the prefixes are equality. 2) Validate that if it's not the first column, prefixes are provided 3) Support incremental sort with index pushdown. ---- #### AI description (iteration 1) #### PR Classification This pull request delivers a new feature and API enhancement to enable order-by index pushdown and refined composite index support. #### PR Summary The update streamlines composite index processing by introducing stricter equivalency checks, new UDF functions for full-scan order-by pushdown, and enhanced validations during index creation while updating explain outputs and tests. - `src/metadata/index.c` refines index options equivalency logic to correctly compare composite term settings. - `src/opclass/bson_gin_composite_entrypoint.c` and `src/index_am/rum.c` add functions to support order-by pushdown and manage duplicate entries efficiently. - `sql/udfs/query/bson_dollar_comparison--0.105-0.sql` (and related operator files) introduce new UDFs including `bson_dollar_fullscan` to enable full scan operations. - `src/commands/create_indexes.c` enforces new composite index validations (restricting use to ascending, non-wildcard regular indexes) with precise error reporting. - Test scripts and explain plan outputs in the `regress` and `pgmongo` directories are updated to confirm the new composite order-by behavior. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
36 lines
913 B
C
36 lines
913 B
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/bson/bson_query_common.h
|
|
*
|
|
* Private and common declarations of functions for handling bson query
|
|
* Shared across runtime and index implementations.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef BSON_QUERY_COMMON_H
|
|
#define BSON_QUERY_COMMON_H
|
|
|
|
#include "io/bson_core.h"
|
|
#include "utils/documentdb_errors.h"
|
|
|
|
/*
|
|
* This struct defines the parameters for a range query.
|
|
*/
|
|
typedef struct DollarRangeParams
|
|
{
|
|
bson_value_t minValue;
|
|
bson_value_t maxValue;
|
|
bool isMinInclusive;
|
|
bool isMaxInclusive;
|
|
|
|
bool isFullScan;
|
|
} DollarRangeParams;
|
|
|
|
DollarRangeParams * ParseQueryDollarRange(pgbsonelement *filterElement);
|
|
|
|
void InitializeQueryDollarRange(pgbsonelement *filterElement, DollarRangeParams *params);
|
|
|
|
#endif
|