[BWARE] Speed up frame-to-matrix conversion and harden number parsing#2480
Open
Baunsgaard wants to merge 2 commits into
Open
[BWARE] Speed up frame-to-matrix conversion and harden number parsing#2480Baunsgaard wants to merge 2 commits into
Baunsgaard wants to merge 2 commits into
Conversation
Tightens the hot path that converts FrameBlocks of arbitrary schema
into MatrixBlocks, with a defensive fallback for malformed cells.
- DoubleParser.parseFloatingPointLiteral: replace the >= 'I' / >= 'a'
character guards with a single 0-9 range check on the last char.
The previous guards over-matched and pushed too many strings into
the slow Double.parseDouble path
- DoubleArray.parseDouble: stop wrapping the parse failure as a
DMLRuntimeException so callers can distinguish format errors
- MatrixBlockFromFrame:
- turn the interface into a class with a private constructor so
Jacoco can measure it cleanly
- on NumberFormatException / DMLRuntimeException during a bulk
block convert, log once and fall back to convertSafeCast which
writes NaN per offending cell instead of failing the whole job
- add convertSafeCast / convertBlockSafeCast helpers
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2480 +/- ##
============================================
+ Coverage 71.37% 71.40% +0.02%
- Complexity 48749 48769 +20
============================================
Files 1571 1571
Lines 188912 188942 +30
Branches 37067 37071 +4
============================================
+ Hits 134845 134905 +60
+ Misses 43601 43578 -23
+ Partials 10466 10459 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Frame-to-matrix conversion silently fell back to writing NaN for cells that cannot be cast to double, logging only a single warning. This changed behavior for callers that previously failed fast on incompatible data. Make the lenient behavior opt-in. - Add sysds.frame.tomatrix.warncast (default false): when false the conversion fails fast on number format errors; when true it warns once and writes NaN for the incompatible cells - Read the flag once on the calling thread and pass it down, since the thread-local config is not visible to pool workers - Extract convertStrict to share the contiguous/generic dispatch between the strict and warn-only paths - Add tests for the warn-only fallback, the strict fail-fast default, and the tightened DoubleParser trailing-character guard
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.
Tightens the hot path that converts FrameBlocks of arbitrary schema into MatrixBlocks, with a defensive fallback for malformed cells.