Repository navigation
fix(native): return null for insufficient variance samples - #1520
Open
hutiefang76 wants to merge 1 commit into
Open
hutiefang76 wants to merge 1 commit into
hutiefang76 wants to merge 1 commit into
Conversation
Return SQL NULL when stdev() or variance() has fewer than two non-NULL inputs. Retain the sample calculation and existing input coercion. Refs xerial#1514 Generated-by: DeepSeek deepseek-v4-pro Generated-by: OpenAI Codex
Author
|
The upstream JDK 21 job reports the 12 pre-fix failures: The verification matrix with the JNI libraries rebuilt from this exact source commit has now passed. The rebuilt libraries are on the separate verification branch linked in the description. |
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.
Related to #1514; this addresses the insufficient-sample result only. The issue's separate request to filter nonnumeric text remains open.
Both aggregates already calculate sample statistics with denominator
n - 1. For fewer than two non-NULL inputs, return SQL NULL instead of reporting a variance or standard deviation of 0. Valid samples retain their existing calculation, including a real zero result for two equal values. Input acceptance and text/BLOB coercion are unchanged.The 18 parameterized cases test
stdevandvarianceindependently: empty/all-NULL input, single integer/REAL values, one value among NULLs, distinct pairs, equal pairs and valid pairs containing NULL.Validation used a separately built Mac/aarch64 source JNI from the unchanged upstream base, with no dependency on the square() fix. The project's
make clean-nativeandmake nativerebuilt the library after the C change; custom library name/output directories kept bundled binaries unchanged. Maven'sorg.sqlite.lib.pathandorg.sqlite.lib.nameselected the built library.mvn verify: 523 tests, 0 failures/errors, 8 skipped; Spotless passed.This changes the undefined-sample result from 0.0 to NULL, so callers must handle NULL. This PR contains source and tests only. The official Build Native run 44288286018 built all 24 native targets successfully. Its final automatic push failed with HTTP 403 because the bot token is read-only; the workflow as a whole is therefore failed.
All 24 artifact ZIP digests were checked against GitHub metadata. The generated libraries were recovered through a normal user push solely on a separate verification branch. A fresh JDK 11 full verify using Maven's default JNI loader and the cross-compiled Mac/aarch64 artifact completed with 523 test records: 515 passed, 0 failures/errors and 8 skipped.
Official CI on verification commit c9d2f1219875 is queued; runtime results for other platforms remain pending. This PR's source commit and bundled binaries are unchanged. Upstream PR CI still needs maintainer approval, and tests using older bundled binaries do not validate the C change.
AI assistance: DeepSeek generated the initial patch/tests and performed a first-pass review. Codex checked the complete diff and executed the native validation.