Repository navigation
Stored "nan"/"inf" values are missing numbers: fix Explore's Code 70 error, one numeric read for every query - #60
Merged
Merged
Conversation
…meric read for every query Some studies record a missing number as the text "nan", "NaN" or "inf". On the public warehouse: prostate_pcbm_swiss_2019 has PSA in 160 patients plus CGA, SYP and Gleason; hcc_meric_2021 has survival months and age; pancan_pdx_uthsa_2023 has telomere measures. toFloat64OrNull reads those as NaN or ±Infinity, not NULL, so they passed every "IS NOT NULL". Explore's histogram binning then failed outright: "Code: 70 … Unexpected inf or nan to integer conversion". This broke Explore for any selection containing such a study, on the internal instance and here alike. Elsewhere the same read was a quiet wrong answer: a NaN minimum or median, a NaN survival time, a NaN plot point. lib/sql-number.ts's finiteSql() is now THE numeric read of a stored value: a finite Float64, or NULL for anything that is not a number, NaN and ±Infinity included. All 49 such reads in lib use it. That covers Explore's statistics and histograms, cohort range clauses, plots, survival months, oncoprint heatmaps, OQL's expression thresholds, composition and timeline lab values. The generic-assay summary already guarded with isFinite and keeps its own form. A unit test fails on any bare toFloat64OrNull in lib outside those two, and the two tests that matched the old SQL text now build their expectation from finiteSql. Verified: Explore on prostate_pcbm_swiss_2019 alone (the failing case), pooled with prad_tcga, and on hcc_meric_2021 and pancan_pdx_uthsa_2023 loads with no error and no non-finite minimum, maximum or median. No gallery example's pinned count moved. scripts/gate.sh green: 172 checks, 1,437 unit tests, 37 cohort-logic checks. A first run had one save-cohort browser step fail, at a menu read unrelated to this change; it passed on the re-run with no code change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TyVfAhLnjshk2kWewGnLum
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
Explore failed on the internal portal with
ClickHouse error … Code: 70 … Unexpected inf or nan to integer conversion. This fixes it, and the same unguarded read everywhere else.Reproduction
Some studies record a missing number as the text
"nan","NaN"or"inf". The public warehouse has them too:POST /api/explore {"study":"prostate_pcbm_swiss_2019"}failed with the Code 70 error, and so did Explore for any selection containing such a study.Cause
toFloat64OrNull("nan")is NaN andtoFloat64OrNull("inf")is Infinity. Neither is NULL, so both passed everyIS NOT NULL. In Explore's histogram binning a NaN fails both edge tests and reachestoInt32(…), which throws.The same read was used in 48 other places. There it did not throw: it gave a quiet wrong answer, such as a NaN minimum or median, a NaN survival time, or a NaN plot point.
Fix
lib/sql-number.ts'sfiniteSql()is the one numeric read of a stored value: a finite Float64, or NULL for anything that is not a number, NaN and ±Infinity included. All 49 such reads inlibnow use it:The generic-assay summary already guarded with
isFiniteand keeps its own form. A new unit test fails on any baretoFloat64OrNullinliboutside those two.Verification
NaNon the page.GATE_PORT=4139 scripts/gate.shpasses on this branch, which is on current master: 172 checks, 1,437 unit tests, 37 cohort-logic checks.Preview
No deploy preview: this repo deploys to Vercel from
master. The internal portal needs a build containing this.🤖 Generated with Claude Code
https://claude.ai/code/session_01TyVfAhLnjshk2kWewGnLum