1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//! Cosmos DB SQL query parser, partition key extraction, and in-memory evaluation.
//!
//! This module provides:
//! - A SQL parser for the Cosmos DB SQL dialect
//! - Partition key filter extraction from WHERE clauses (to avoid Gateway query plan calls)
//! - In-memory document matching and projection (for test emulators)
pub
pub
pub
pub
pub
pub
pub
// Used by tests, the in-memory evaluator, and the (not-yet-wired) local plan caller.
pub use parse;
/// Production-safe list of query features the local plan generator
/// advertises to the Cosmos DB Gateway via
/// `x-ms-cosmos-supported-query-features`.
///
/// Advertised as `"None"`: the cross-partition
/// query pipeline does not yet support any of the advanced rewrite shapes the
/// Gateway can plan (Aggregate, CompositeAggregate, CountIf, DCount, Distinct,
/// GroupBy, HybridSearch, MultipleAggregates, MultipleOrderBy,
/// NonStreamingOrderBy, NonValueAggregate, OffsetAndLimit, OrderBy, Top,
/// WeightedRankFusion); advertising any of them in production would cause the
/// Gateway to return a plan we cannot execute. Add a feature here only after
/// the local pipeline gains support for the corresponding rewrite shape.
///
/// The value must be non-empty: the Gateway V2 thin-client proxy rejects
/// QueryPlan requests where the `x-ms-cosmos-supported-query-features` header
/// (and its RNTBD `SupportedQueryFeatures` token) is missing.
///
/// Tests use [`__TEST_ONLY_SUPPORTED_QUERY_FEATURES`] (broad, matches what
/// Java/.NET advertise) so plan-shape parity against the live Gateway is
/// validated end-to-end across the full feature surface.
pub const SUPPORTED_QUERY_FEATURES: &str = "None";
/// Broad supported-features list used by cross-crate gateway-comparison
/// tests. Matches what the Java and .NET SDKs send today so the Gateway
/// returns the same plan shape across SDKs and plan-parity tests stay
/// meaningful. Production callers must not depend on this — it shares the
/// `__internal_testing` feature gate and is not covered by SemVer.
pub const __TEST_ONLY_SUPPORTED_QUERY_FEATURES: &str = "Aggregate,CompositeAggregate,CountIf,DCount,Distinct,GroupBy,HybridSearch,MultipleAggregates,MultipleOrderBy,NonStreamingOrderBy,NonValueAggregate,OffsetAndLimit,OrderBy,Top,WeightedRankFusion";
pub use __test_only_generate_query_plan_for_pk_paths;