Repository navigation
Conversation
Replace correlated frequency queries with grouped MODE aggregates. Preserve null handling and tie-breaking, and cover empty ranges and leading/trailing gaps with regression tests. BREAKING CHANGE: MODE with gapFill=true now includes empty buckets as null-valued results across the inclusive query range. Results may contain more rows and exceed the configured datapoint query limit. Use gapFill=false to retain populated-bucket-only results.
Normalize JSON nulls before casting and remove the fallback that replaced unavailable differences with absolute readings. Document carry-forward semantics and add regression coverage. BREAKING CHANGE: With gap filling enabled, the first reading after a leading empty bucket now yields null instead of its absolute value as the difference.
Restore MODE's existing populated-bucket-only behavior for both gapFill settings, retaining JSON-null handling and numeric/boolean tie-breaking. Restore the corresponding expectations and document the MODE limitation. The gap-fill behavior change and its regression coverage will be carried by bugfix/mode-query-gap-fill as a separate follow-up.
Use grouped MODE aggregates so time_bucket_gapfill can produce empty buckets across the inclusive requested range. Preserve JSON-null handling, numeric and boolean tie-breaking, and populated-only results when disabled. Migrate the internal, leading/trailing, entirely empty range and inclusive end-boundary assertions from the JSON-null PR. Add coverage for sparse queries exceeding the configured result limit after gap filling. Release note / compatibility: MODE with gapFill=true now returns null-valued empty buckets. Existing callers may receive more results and exceed OR_DATA_POINTS_QUERY_LIMIT (100,000 by default). Use gapFill=false to preserve populated-bucket-only results, or reduce the range or increase the interval to request fewer buckets. This applies to historical and predicted numeric/boolean data.
ebariaux
requested review from
a team and
richturner
and removed request for
a team
October 23, 2026 15:40
6 tasks
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
MODE queries previously returned only buckets containing datapoints, even
when
gapFill=true. They now include empty buckets throughout the requestedrange, including leading/trailing gaps and entirely empty ranges.
The fix uses grouped PostgreSQL MODE aggregates for historical and predicted
numeric and boolean datapoints. Existing null handling and tie-breaking are
preserved, and the dependency on PostgreSQL’s tie-breaking behavior is
documented.
This follows the JSON-null query fixes in #3447.
Compatibility / migration
This changes results for existing callers using MODE with
gapFill=true:These serialize as
{"x":…}, withyomitted.OR_DATA_POINTS_QUERY_LIMIT, which defaultsto 100,000. Sparse queries over large ranges with small intervals may now
exceed this limit.
gapFill=falseto retain populated-bucket-only results. Alternatively,shorten the requested range or use a larger interval.
Release notes
MODE datapoint queries now honor
gapFill=true, returning empty bucketswith unavailable values across the requested range. This applies to
historical and predicted numeric and boolean datapoints.
Existing callers may receive more datapoints and reach the configured query
limit (100,000 by default). Use
gapFill=falseto preserve the previouspopulated-bucket-only behavior, or request a shorter range or larger interval.
Empty buckets omit the
yproperty in JSON responses.