Repository navigation
fix: serialize FLOAT/DOUBLE NaN/±Inf via bit_cast so SQL dumps restore (matrixorigin/matrixone#30596) - #71
Conversation
Quoted 'NaN'/'+Inf'/'-Inf' literals abort strict-mode restores with ERROR 1265 Data truncated since matrixorigin/matrixone#31191: the SQL script fails at the first INSERT and the target stays empty, so nothing of a stored IEEE special round-trips (matrixorigin/matrixone#30596). Serialize the FLOAT/DOUBLE wire text of NaN/±Inf as bit_cast(unhex('<LE hex>') as <float|double>) expressions that rebuild the canonical IEEE word from raw bytes, so the strict-mode text rule does not apply. The hex words are fixed little-endian constants taken from the server's own special-value fixtures; no user data is interpolated. Restore is verified live under the default strict, MATRIXONE_NATIVE and NO_BACKSLASH_ESCAPES sessions. Unknown non-numeric wire text keeps the legacy quoted form; finite passthrough, -0 (cast form, mo_dump#58) and NULL handling are unchanged; CSV mode is unchanged. The text wire carries no NaN payload bits, so the canonical quiet-NaN word is restored — the same canonical value the CSV roundtrip restores. Tests: cmd/mo-dump TestConvertValueFloatSpecials (specials × float/double, unknown-text fallback, string-column 'NaN' stays quoted, -0/float32-overflow cast forms, finite passthrough, NULL); go test ./... passes. Live single-node round-trip on current MatrixOne main: this branch restores 6/6 rows with identical text rendering and a byte-identical second export, CSV LOCAL and native/NO_BACKSLASH sessions pass, and the pre-fix dump still fails with ERROR 1265 while the connection stays reusable.
|
Queued — the merge queue status continues in this comment ↓. |
✅ Merged into
|
|
Reviewed exact head No blocking issues found; recommendation: APPROVE. The six fixed IEEE words decode to the correct FLOAT/DOUBLE NaN and signed infinities and match MatrixOne's Validation:
The stated limits are appropriate: these expressions target MatrixOne, and the text wire permits restoring a canonical NaN rather than preserving its payload bits. The live evidence is single-CN; this review does not claim a new multi-CN/Proxy run. This comment records the review recommendation; it is not a GitHub approval. |
Problem
After mo_dump#58 quoted the FLOAT/DOUBLE NaN/±Inf tokens and MatrixOne changed text-to-float semantics in strict sessions (matrixorigin/matrixone#31191), a mo-dump SQL script can no longer recreate stored IEEE special values: the default MySQL-compatible strict restore aborts at the first INSERT with
and the target table stays empty. This is the end-to-end dump/restore regression tracked in matrixorigin/matrixone#30596; it is still reproducible on current mo_dump main and current MatrixOne main.
Change
bit_cast(unhex('<LE hex>') as <float|double>): the expression rebuilds the canonical IEEE word from raw bytes, so the strict-mode text rule does not apply. The hex words are fixed little-endian constants taken from the MatrixOne special-value fixtures; no row data is interpolated.-0(cast form, from mo_dump#58) and NULL handling are unchanged; the CSV mode is unchanged.Tests
cmd/mo-dumpTestConvertValueFloatSpecialspins the serialization matrix: specials x float/double -> bit_cast tokens, unknown non-numeric text keeps quotes, a string column storing 'NaN' remains a plain string literal,-0and float32-overflow wire text keep their cast forms, finite values pass through, NULL stays NULL.make testpasses on this branch.ERROR 1265 ... Data truncated for DOUBLE value: 'NaN', target rows 0, connection stays usable;MATRIXONE_NATIVEsession 6/6, aNO_BACKSLASH_ESCAPESsession 6/6 (the script's sql_mode pin), and an intentionally quoted 'NaN' INSERT still raises 1265 with the same connection reusable afterwards.Limits