MOD-12347 Add support for NaN values#1853
Merged
Merged
Conversation
| rule->startCurrentTimeBucket = currentTimestampNormalized; | ||
| RedisModule_CloseKey(key); | ||
| } | ||
| rule->aggClass->appendValue(rule->aggContext, value, timestamp); |
There was a problem hiding this comment.
TWA compaction loses interpolation data through NaN-only buckets
Medium Severity
When a TWA compaction rule processes a bucket containing only NaN samples, subsequent buckets lose the previous valid sample information needed for interpolation. The condition at line 651 checks hadValidSamples, but when a NaN-only bucket is skipped, hadValidSamples is false even though getLastSample still returns valid data from the bucket before the NaN-only one. This causes addPrevBucketLastSample to be skipped, breaking TWA interpolation for the next bucket.
galcohen-redislabs
approved these changes
Jan 14, 2026
galcohen-redislabs
approved these changes
Jan 14, 2026
This was referenced Jan 29, 2026
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.
Note
Adds comprehensive NaN support across ingestion, storage, queries, and compaction.
COUNTNANandCOUNTALLaggregations (CREATERULE/RANGE/REVRANGE/MRANGE; parsing, enum, dispatch, and info wired) and per-aggregatorisValueValidto control NaN participationCOUNTNANcounts only NaNs,COUNTALLcounts all samples; vectorized max falls back when NaNs presentEMPTY; skips NaNs when fetching boundary samples; tracksvalidSamplesInBucketto suppress NaN-only outputs unlessEMPTYNaN(case-insensitive) inTS.ADD/MADD; RESP2 prints "NaN", RESP3 returns float NaN;INCRBY/DECRBYreject NaN operands; IGNORE never deduplicates on NaN; clearer duplicate-policy error when NaN with MIN/MAX/SUMTS.INFOreflects new aggs; enums/string mappings extended; minor JSON schema tidyWritten by Cursor Bugbot for commit 25b0c8a. This will update automatically on new commits. Configure here.