Skip to content

Add $bucketAuto aggregation stage compatibility tests - #675

Merged
eerxuan merged 2 commits into
documentdb:mainfrom
jingyaog:test/bucketAuto-compatibility-tests
Jul 13, 2026
Merged

Add $bucketAuto aggregation stage compatibility tests#675
eerxuan merged 2 commits into
documentdb:mainfrom
jingyaog:test/bucketAuto-compatibility-tests

Conversation

@jingyaog

@jingyaog jingyaog commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Feature being tested

The $bucketAuto aggregation stage — automatic bucketing of documents into a
specified number of buckets based on a groupBy expression, with even document
distribution, boundary/type preservation, optional preferred-number granularity
series, and per-bucket output accumulators.

Test cases

139 test cases across 10 files:

File Cases Area
bucketAuto/test_bucketAuto_core_semantics.py 8 Empty/nonexistent collection, single doc, identical values, fewer unique/docs than buckets, even/uneven distribution
bucketAuto/test_bucketAuto_boundaries.py 16 Boundary shape (min inclusive, interior max exclusive, final max inclusive, shared edges, global bounds), BSON type preservation, numeric equivalence, mixed-type ordering, Decimal128 precision (incl. extreme min/max)
bucketAuto/test_bucketAuto_buckets_validation.py 25 buckets accepts int32/int64/whole-double/whole-Decimal128/1; rejects 0/negative/fractional/NaN/Infinity/overflow/non-numeric types
bucketAuto/test_bucketAuto_groupby.py 7 groupBy expression types, null/missing grouping
bucketAuto/test_bucketAuto_arg_errors.py 24 Argument container validation (non-object types, unrecognized/case-variant options, missing required)
bucketAuto/test_bucketAuto_granularity.py 18 All preferred-number series accepted; R5 / 1-2-5 / E6 / POWERSOF2 rounding; coarse→fewer buckets; unknown/empty/non-string rejection; non-numeric/NaN/negative groupBy rejection
bucketAuto/test_bucketAuto_output.py 12 Implicit count, output replaces count, explicit {$sum:1}, empty output, multiple accumulators, input-vs-sibling refs, nested expressions, $push with $$ROOT/$$CURRENT/$$REMOVE, special/duplicate field names
bucketAuto/test_bucketAuto_output_errors.py 20 Output non-object types, $-prefix, dotted names, non-accumulator values
bucketAuto/test_bucketAuto_accumulator_errors.py 2 Accumulator error propagation (field-driven conversion, literal divide-by-zero)
stages/test_stages_position_bucketAuto.py 7 Multi-stage interactions ($match before; $sort/$limit/$skip after; $facet; feeding $group/$project) — placed in parent stages/ folder per FOLDER_STRUCTURE.md

Framework additions:

  • error_codes.py$bucketAuto error-code constants (40239–40246, 40257–40261)
  • test_constants.pyGRANULARITY_VALUES preferred-number series list

MongoDB 8.2 documentation

TEST_COVERAGE.md guideline updates

None. No changes to TEST_COVERAGE.md were required — the existing §15 (pipeline
stages) and §18 (accumulators, which already names $bucketAuto) already scope this
feature. The new error-code constants and GRANULARITY_VALUES are additive framework
support and did not warrant new rule text.

@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jul 10, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, enhancement
Project fields suggested: Component test-coverage · Priority P2 · Effort XL · Status Needs Review
Confidence: 0.90 (mixed)

Reasoning

component from path globs (test-coverage, test-framework); effort from diff stats (2139+0 LOC, 12 files); LLM: Adds 141 new compatibility test cases across 10 files covering the $bucketAuto aggregation stage, plus framework-level additions to error_codes.py and test_constants.py, touching multiple files across the test-coverage component.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@jingyaog
jingyaog force-pushed the test/bucketAuto-compatibility-tests branch from 09611aa to f813fbf Compare July 10, 2026 00:37
@jingyaog
jingyaog requested a review from a team as a code owner July 10, 2026 00:37
Comment thread documentdb_tests/framework/test_constants.py Outdated
Add compatibility test coverage for the $bucketAuto aggregation stage
across core distribution semantics, boundary/type preservation, buckets
and groupBy validation, granularity series, output specification, output
and accumulator error propagation, and multi-stage interactions.

Framework additions:
- error_codes.py: $bucketAuto error-code constants (40239-40246, 40257-40261)
- test_constants.py: GRANULARITY_VALUES preferred-number series

Signed-off-by: Aaron Gong <jingyaog@amazon.com>
@jingyaog
jingyaog force-pushed the test/bucketAuto-compatibility-tests branch from f813fbf to c584134 Compare July 13, 2026 18:53
@eerxuan
eerxuan merged commit fa81857 into documentdb:main Jul 13, 2026
20 checks passed
RyanGarfinkel pushed a commit to RyanGarfinkel/functional-tests that referenced this pull request Jul 20, 2026
Signed-off-by: Aaron Gong <jingyaog@amazon.com>
Signed-off-by: RyanGarfinkel <113050972+RyanGarfinkel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants