Skip to content

[Bug]: mo-dump SQL emits unquoted DOUBLE NaN/Inf and cannot restore valid rows #30596

Closed
matrixorigin/mo_dump
#58

Description

@Ariznawlll

Description

mo-dump reports a successful SQL export of valid DOUBLE NaN and ±Infinity values, but writes those values as unquoted identifiers. Restoring the script fails at the first INSERT, leaving the recreated table empty. FLOAT special values are already quoted by the same formatter; the DOUBLE branch is not.

Environment

  • MatrixOne main: 75ff736835c3d00d40dc00a0a1d3b11129388e5b
  • mo_dump main: 324c33dbdc7075cd5d7beaafd1e15c76709dd442
  • Isolated single LOG/TN/CN deployment; MySQL-protocol client.

Reproduce

CREATE DATABASE md_double_special_src;
CREATE TABLE md_double_special_src.t (id INT PRIMARY KEY, f FLOAT, d DOUBLE);
INSERT INTO md_double_special_src.t VALUES
  (1, CAST('NaN' AS FLOAT), CAST('NaN' AS DOUBLE)),
  (2, CAST('Infinity' AS FLOAT), CAST('Infinity' AS DOUBLE)),
  (3, CAST('-Infinity' AS FLOAT), CAST('-Infinity' AS DOUBLE)),
  (4, 1.25, 1.25), (5, NULL, NULL);

Export with mo-dump -db md_double_special_src > dump.sql; retarget only the database name in a copy of the script before importing into an empty database. The generated data statement begins:

INSERT INTO `t` VALUES (1,'NaN',NaN),(2,'+Inf',+Inf),(3,'-Inf',-Inf),(4,1.25,1.25),(5,NULL,NULL);

Result and controls

  • Three independent fresh source databases: SQL export exited 0 with MODUMP SUCCESS 3/3; import exited 1 with ERROR 20301 ... ambiguous column reference 'NaN' 3/3. Each restored table had 0 rows. Each source retained all 5 rows; subsequent SELECT 1 was usable.
  • The same three sources exported as CSV and restored with LOAD DATA LOCAL INFILE 3/3. Each target retained NaN, +Infinity, -Infinity, 1.25, and NULL in both columns, with 5 rows.
  • SQL export with -where 'id>=4' (finite value and NULL only) restored correctly with 2 rows. The source accepts CAST('NaN' AS DOUBLE) and CAST('+Inf' AS DOUBLE); this is not an invalid input fixture.
  • An independent FLOAT-only table with the same five values also completed SQL dump/restore successfully. Its restored rows were NaN, +Infinity, -Infinity, 1.25, and NULL, pinpointing the gap to the DOUBLE formatter branch.

Code analysis / regression

cmd/mo-dump/main.go:740-759 quotes nonnumeric FLOAT values, but includes double in the numeric passthrough branch. Quoting the DOUBLE special literals is needed for a restorable SQL dump. Historical merged matrixone#8084 implemented the special-value quote for FLOAT only; this DOUBLE gap remains in the pinned mo_dump main. Add a real SQL dump/restore regression for NaN, +Infinity, -Infinity, finite and NULL values for both floating types. This is distinct from #30521 (text-wire scientific notation).

Activity

  1. added this to the MO-202610 milestone on Oct 19, 2026
  2. added
    kind/bug
    on Oct 19, 2026
  3. added theissue type on Oct 19, 2026
  4. assigned and unassigned on Oct 26, 2026
  5. slyunnn commented on Oct 27, 2026

    @slyunnn

    Regression and extended verification for #30596 (2026-10-27)

    @aptend @iamlinjunhong — the merged tool fix and the later MatrixOne text-to-float change now conflict in the default restore mode; please coordinate the integration fix.

    Verification Environment

    • MatrixOne latest main: 2465dae7a4ada1b277113cca5afff6fe10149b96 — refactor: consolidate unused code and bookkeeping cleanup (#31348); the rebuilt running binary reported git_version() = 2465dae7a4 on all routes.
    • mo-dump latest main: d9d6375512620f12ff371b8602cc1d10d6f6caa0 — fix: make SQL/CSV dump scripts restore-safe (#30596 #30598 #30587 #30590 #30628 #30481) (#58). Related changes: mo_dump PR #58 and the subsequently merged MatrixOne PR #31191, commit 861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f.
    • Isolated topology: 2 CN / 1 TN / 1 Log service / Proxy. Container endpoints Proxy 6001, CN1 16001, CN2 16002 were mapped to host 6601, 16601, 16602; all three were connected and tested independently.
    • Export used the mo-dump MySQL driver; SQL and CSV restores used native mysql 9.7.1 over the MySQL text protocol. CSV restore enabled LOCAL INFILE.

    What Was Covered

    • OK — Stored IEEE FLOAT/DOUBLE NaN, +Infinity, and -Infinity values were created using exact BIT_CAST(UNHEX(...)) expressions; source rows were readable on all 3 routes. The old textual CAST('NaN' AS DOUBLE) fixture is no longer valid in the current default MySQL-compatible mode by design of PR Fix decimal rounding and MySQL text-to-float casts #31191.
    • OK — mo-dump SQL export returned 0 with MODUMP SUCCESS and no longer emitted bare identifiers. Its data line includes (1,'NaN','NaN'),(2,'+Inf','+Inf'),(3,'-Inf','-Inf').
    • Failed — Native-client SQL restore in the default strict mode returned 1265 (Data truncated for DOUBLE value: 'NaN') at the INSERT on Proxy, CN1, and CN2; each recreated target table contained 0 rows. Connections remained usable.
    • OK — Finite 1.25 and NULL SQL-dump controls restored exactly on all 3 routes.
    • OK — The same 5-row IEEE/finite/NULL fixture round-tripped through mo-dump -csv and LOAD DATA LOCAL INFILE on all 3 routes.
    • OK — The exact failing SQL dump restored its 5 rows through Proxy when the restore session explicitly used MATRIXONE_NATIVE; this is a mode-specific control, not a fix for default-mode restore.
    • Not covered — Every NaN payload bit pattern, S3/remote files, and live native-mode restore through both direct CN ports.

    Findings

    PR #58 fixed the unquoted DOUBLE tokens, but end-to-end SQL restoration is still broken on current main. PR #31191 intentionally treats textual NaN/Inf as nonnumeric text in MySQL-compatible mode; strict assignments reject them. The tool's new quoted serialization therefore cannot recreate otherwise valid stored IEEE values under the default mode. A type-aware restore representation or equivalent cross-component contract is needed. This is the same user-visible restore failure already tracked by #30596, so no duplicate issue was opened.

    Large-data regression required: No. One stored IEEE row is sufficient to cross this parser/assignment boundary; more rows would not change the failure.

    MOTR / BVT Coverage

    The mo_dump repository's full make test passed at the tested commit, but it did not catch this later MatrixOne compatibility change. A live cross-version SQL export/restore regression should be added with the fix. No passing MOTR case or PR was submitted for a still-failing contract.

    Final Conclusion

    Partially fixed: bare DOUBLE tokens are gone, but #30596's required SQL dump/restore roundtrip is not fixed on current MatrixOne main in the default mode. Keep the issue open for integration repair and retest.

  6. assigned and unassigned on Oct 27, 2026
  7. added a commit that references this issue on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions