Phixsura commented on PR #38704:
URL: https://github.com/apache/shardingsphere/pull/38704#issuecomment-4602130072
Pushed `ffbf6724` on top of current master.
For #31899 binary-literal (P1.B): `MySQLBinaryLiteralRecognizer` now
recognises the `x'..'` / `X'..'` / `0x..` hex literal text and the `b'..'` /
`B'..'` / `0b..` bit literal text that the parser carries as
`CommonExpressionSegment`, decodes the bytes, and emits an ISO-8859-1 character
literal. For ASCII-range bytes that mapping preserves byte length under UTF-8
encoding, so the exact reproducer `SELECT LOCATE(x'64', _utf8mb4'abcdef')` now
compiles and routes through `LOCATE("d", "abcdef")` returning 4, and `SELECT
LENGTH(x'48656c6c6f')` returns 5. Pinned in `SQLStatementCompilerIT` (cases
110-112) and unit-covered in `MySQLBinaryLiteralRecognizerTest` (20 cases
including null / empty / odd-digit / unrelated text counterexamples). Reverting
the recognizer call site puts the reproducer back on the `unsupported
CommonExpressionSegment` throw, so the issue path is genuinely closed.
For trunk-database-type gate (P1.C):
`CompilerContextFactory#isMySQLTrunkDatabaseType` now treats any database type
whose `getTrunkDatabaseType()` resolves to MySQL as MySQL-trunk, so MariaDB and
Doris pick up `MySQLStringFunctionOperatorTable` while non-MySQL-trunk types
(e.g. a PostgreSQL-trunk dialect) stay out. Covered with positive cases for
MariaDB-like and Doris-like contexts and a PostgreSQL-trunk negative case in
`CompilerContextFactoryTest`.
For charset semantics (P1.A): the byte-to-ISO-8859-1 mapping resolves binary
literals end-to-end on ASCII payloads (the dominant case for #31899). Bytes
0x80-0xFF in hex literals expand to two UTF-8 bytes after the char mapping, and
`_latin1` / `_utf8mb4` introducers are stripped by the MySQL parser before
reaching the converter; both gaps require parser-level changes to preserve the
original byte/charset on the segment, which I'd rather propose as a follow-up
rather than fold into this PR. Documented inline on
`MySQLBinaryLiteralRecognizer` and `MySQLLengthFunction`.
`./mvnw test -pl kernel/sql-federation/compiler` is 342/342;
`spotless:check` and `checkstyle:check` clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]