Repository navigation
JVM bulk loads: search for a subnormal exponent, not any "e-3" - #183
Merged
Merged
Conversation
#180 sends a bulk JSON chunk through a per-row Python walk when its text contains "e-3", to catch a subnormal double the engine's parser would read as a BigDecimal. "e-3" is common in ordinary text (hex ids, UUIDs, "name-3"), so such loads walked every chunk. The text is now searched for the exponent json.dumps writes for a subnormal (e-308 to e-329 after a digit) with a compiled pattern: the same C-speed scan, no false hits on ordinary text. Test: UUID-like and "name-3" text never reaches the walk; 5e-324 and the largest subnormal still raise ValueError (per-row path). Closes #182 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #182
type_conversion._dumps_checked(from #180) now searches the JSON text for the exponentjson.dumpswrites for a subnormal double (e-308toe-329after a digit, compiled pattern) instead of any"e-3". Same C-speed scan; ordinary text such as UUIDs, hex ids orname-3no longer sends a chunk through the per-row Python walk.Test:
tests/test_bulk_json_paths.py::test_text_that_only_looks_like_an_exponent_skips_the_subnormal_walk(counts the walk calls with a wrapped_has_subnormal: none for UUID-like text and1e-30;5e-324and2.2250738585072009e-308still raiseValueError, the per-row path). With the previous substring check the first assertion fails, since"e-3"occurs in"4fe-3a0"and"name-3"(checked against the old condition directly). black, isort, pyflakes clean.🤖 Generated with Claude Code