Phixsura opened a new pull request, #38697:
URL: https://github.com/apache/shardingsphere/pull/38697

   ### What
   
   ShardingSphere-Proxy advertises a MySQL `YEAR` column to clients as protocol
   type `DATE` (0x0a) instead of `YEAR` (0x0d). Because mysql-connector-j 
inspects
   that byte to decide between `java.sql.Date` and `Short`, the driver's
   `yearIsDateType=false` URL parameter has no effect when talking to Proxy.
   
   ### Why
   
   Backend JDBC reports YEAR as `Types.DATE`, and the existing
   `MySQLBinaryColumnType.valueOfJDBCType(int)` only knows `Types.DATE → DATE`,
   so YEAR cannot be distinguished. `PostgreSQLBinaryColumnType` already solved
   the same shape of problem with a `(jdbcType, columnTypeName)` overload.
   
   ### How
   
   - Add `MySQLBinaryColumnType.valueOfJDBCType(int, String)` and an `isYear`
     helper, returning `YEAR` only when JDBC type is `DATE` and the column type
     name is `YEAR`.
   - Switch the text-protocol column-definition builder 
(`ResponsePacketBuilder`)
     to the new overload.
   
   The binary (prepared-statement) protocol path has the same shape of issue
   but needs a paired writer change to send a 2-byte short instead of a
   `java.sql.Date` blob; that is worth its own PR and will be sent as a
   follow-up.
   
   ### Tests
   
   - `MySQLBinaryColumnTypeTest`: YEAR detection (case-insensitive), DATE
     fallback (including `null` type name), and the `isYear` helper.
   - `ResponsePacketBuilderTest`: parametric test now asserts the on-wire
     column-type byte; added rows pin down YEAR → 0x0d and DATE → 0x0a.
   
   Closes #28858.


-- 
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]

Reply via email to