Skip to content

feat: parse MySQL CHECKSUM TABLE and histogram update options - #2883

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-analyze-checksum-20261031
Oct 31, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-analyze-checksum-20261031

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

CHECKSUM TABLE failed, and so did the MySQL 8.4 forms of ANALYZE TABLE … UPDATE HISTOGRAM that end in AUTO UPDATE or MANUAL UPDATE or that give the histogram with USING DATA 'json'. CHECK, OPTIMIZE and REPAIR TABLE (#2788) and the other histogram forms (#2542) already parsed.

CHECKSUM TABLE t1, t2 [QUICK | EXTENDED] is a TableMaintenanceStatement with the new operation CHECKSUM. Like the other operations, it accepts only its own options: no NO_WRITE_TO_BINLOG or LOCAL, and one of QUICK and EXTENDED. CHECKSUM becomes a non-reserved keyword, so it stays usable as a name, as a function name and as the CHECKSUM table option. Feature analysis reports READS_DATA and RETURNS_RESULT_SET, as for CHECK TABLE.

Analyze keeps the update mode in getHistogramUpdateMode() (AUTO or MANUAL) and the JSON in getHistogramData(), a StringValue. USING DATA excludes the bucket count and the update mode, and DROP HISTOGRAM takes none of them, as in MySQL.

Public method signatures are retained. TableMaintenanceStatement.Operation gains CHECKSUM.

Syntax reference: MySQL 8.4 CHECKSUM TABLE, ANALYZE TABLE.

Validation:

  • TableMaintenanceStatementTest adds 4 CHECKSUM TABLE statements, checked with and without the MySQL and MariaDB dialects, plus 6 rejected forms, CHECKSUM as a column, table and function name and as a table option, and the reported features. AnalyzeTest adds 3 histogram statements, a built statement and 6 rejected forms. TableMaintenanceValidatorTest covers CHECKSUM TABLE. All 7 statements fail on master dd03d6ff1.
  • MySQL 8.4.11 accepts all 7 statements and rejects the 12 rejected forms with syntax errors. A histogram JSON read from information_schema.COLUMN_STATISTICS and given back with USING DATA is accepted by MySQL and round-trips through the parser.
  • Java 17 Gradle check: 12,341 tests, 0 failures, 25 skipped. Grammar ambiguity, formatting (Spotless ratchet against upstream/master), Checkstyle, PMD, SpotBugs and JaCoCo pass.

AI assistance: prepared with Claude Code.

CHECKSUM TABLE failed, and so did the MySQL 8.4 forms of ANALYZE TABLE
... UPDATE HISTOGRAM that end in AUTO UPDATE or MANUAL UPDATE or that
give the histogram with USING DATA.

CHECKSUM TABLE is a TableMaintenanceStatement with the new operation
CHECKSUM, which takes no modifier and one of QUICK and EXTENDED. CHECKSUM
becomes a non-reserved keyword, so it remains usable as a name and as a
table option. Analyze keeps the update mode in getHistogramUpdateMode()
and the JSON in getHistogramData(); USING DATA excludes the bucket count
and the update mode, and DROP HISTOGRAM takes none of them.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit b245090 into JSQLParser:master Oct 31, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ Proxy