GroupByIn range no-proof folds In branches
Summary
AverageMode::GroupByIn promises one aggregate entry per In value, but the
no-proof range path folds all In branches into a single aggregate entry with
in_key: None / empty key. The prove path preserves per-In branches, so
prove and no-proof behavior diverge for the same query shape.
Found while reviewing #3603, but this is pre-existing query-layer behavior, not
a regression from that shielded-spend PR.
Details
Relevant path:
packages/rs-drive/src/query/drive_document_count_and_sum_query/drive_dispatcher.rs
When AverageMode::GroupByIn is combined with a range clause, the no-proof
branch unwraps the joint executor's folded Aggregate { count, sum } and
rewraps it as a single AverageEntry. That loses the In axis entirely, so
callers cannot distinguish which In value contributed what.
This conflicts with:
AverageMode::GroupByIn docs in drive_document_average_query/mod.rs, which
describe one entry per In value.
- The prove path in
drive_document_average_query/drive_dispatcher.rs, which
preserves per-In branches for GroupByIn + range.
Expected resolution
Either:
- Preserve per-
In (count, sum) entries on the no-proof path, matching the
documented GroupByIn contract and the prove path, or
- Update the public
AverageMode::GroupByIn documentation to explicitly state
that GroupByIn + range no-proof queries fold across In values.
GroupByIn range no-proof folds In branches
Summary
AverageMode::GroupByInpromises one aggregate entry perInvalue, but theno-proof range path folds all
Inbranches into a single aggregate entry within_key: None/ emptykey. The prove path preserves per-Inbranches, soprove and no-proof behavior diverge for the same query shape.
Found while reviewing #3603, but this is pre-existing query-layer behavior, not
a regression from that shielded-spend PR.
Details
Relevant path:
packages/rs-drive/src/query/drive_document_count_and_sum_query/drive_dispatcher.rsWhen
AverageMode::GroupByInis combined with a range clause, the no-proofbranch unwraps the joint executor's folded
Aggregate { count, sum }andrewraps it as a single
AverageEntry. That loses theInaxis entirely, socallers cannot distinguish which
Invalue contributed what.This conflicts with:
AverageMode::GroupByIndocs indrive_document_average_query/mod.rs, whichdescribe one entry per
Invalue.drive_document_average_query/drive_dispatcher.rs, whichpreserves per-
Inbranches forGroupByIn + range.Expected resolution
Either:
In(count, sum)entries on the no-proof path, matching thedocumented
GroupByIncontract and the prove path, orAverageMode::GroupByIndocumentation to explicitly statethat
GroupByIn + rangeno-proof queries fold acrossInvalues.