feat: model MySQL expression-first CONVERT syntax - #2667
Merged
manticore-projects merged 1 commit intoSep 21, 2026
Merged
Conversation
Signed-off-by: minleejae <mmj9808@gmail.com>
Contributor
|
Thank you! |
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.
MySQL
CONVERT(expression, type)is not represented by the existing CONVERT grammar, which primarily handles the SQL Server type-first form and character-set conversion with USING. Valid casts such asCONVERT(amount, DECIMAL(12,4))therefore fail or are interpreted in the wrong argument order.Replace the internal boolean syntax choice in TranscodingFunction with USING, TYPE_FIRST and TYPE_LAST variants, retaining the existing constructors and boolean accessors. Share its rendering with ExpressionDeParser so operand visitors and type mutations work consistently. Reuse ColDataType for lengths, precision and character-set clauses.
The MYSQL dialect selects expression-first parsing for ambiguous inputs such as
CONVERT(value, CHAR). Default and SQLSERVER parsing retain the existing type-first precedence; callers processing ambiguous MySQL input should explicitly selectDialect.MYSQL. Regression coverage includes USING, SQL Server styles and TRY_CONVERT, nested conversions, NULL, parameters, type mutation and incomplete arguments.Syntax reference: MySQL conversion functions.
Validation:
checkpassed on Java 17, including grammar ambiguity, formatting, static analysis, coverage and the full test suite. JUnit XML totals: 7997 tests, 0 failures/errors, 25 skipped.toString()output andStatementDeParseroutput executed successfully with matching query results or resulting schema state. Invalid inputs were rejected by the server.