Phixsura commented on PR #38697:
URL: https://github.com/apache/shardingsphere/pull/38697#issuecomment-4564776195

   B1 已修。`MySQLComStmtExecuteExecutor#adjustValueForBinaryColumnType` 现在把任何 
`Number` 形态的 YEAR 在写包前规范成 `int`,`Date` / `Short` / `Integer` / `Long` 
都走同一路径,binary protocol 写包不会再因为 `MySQLInt2BinaryProtocolValue:37` 的 `(Integer) 
value` cast 抛 ClassCastException。回归测试 
`MySQLComStmtExecuteExecutorTest#assertYearColumnFromShortValueEncodedAsShort` 
用 `new QueryResponseCell(Types.DATE, Short.valueOf((short) 1925), "YEAR")` pin 
住 `Short` 路径,packet 体读出 0x00 0x00 + LE 1925。撤回 `Number` 分支后该用例报 `class 
java.lang.Short cannot be cast to class java.lang.Integer`,跟你描述的失败模式一字不差。
   
   B2 已修。`MySQLComStmtPrepareExecutorTest#createDatabase` schema fixture 增了 
`birth_year` (Types.DATE, "YEAR") 和邻接的 `birth_date` (Types.DATE, "DATE") 
两列,显式贯穿 `column.getColumnTypeName()`。新增三条 prepare 路径用例:
   - `assertPrepareSelectYearAndDateColumnsExposesProtocolTypesFromLocalSchema` 
走 `MySQLComStmtPrepareExecutor:207` (local schema projection),断言 YEAR 
projection column type = `MySQLBinaryColumnType.YEAR.getValue()` (0x0d),邻接 DATE 
projection = 0x0a。
   - `assertPrepareSelectWithYearAndDateParameterMarkersCarriesProtocolTypes` 走 
`MySQLComStmtPrepareExecutor:145` (parameter marker),断言 `parameterColumnTypes` 
严格等于 `[YEAR, DATE]`。
   - `assertPrepareSelectExpressionStatementByProbeReturnsYearProtocolType` 走 
`MySQLProjectionMetadataResolver:100` (probe metadata),mock 
`ResultSetMetaData.getColumnType=Types.DATE` + `getColumnTypeName="YEAR"`,断言 
projection column type = 0x0d,跟邻位 
`assertPrepareSelectExpressionStatementByProbe` 的 BIGINT 反例对照。
   
   Head `c8998e46add`。`./mvnw test -pl proxy/frontend/dialect/mysql` 166/166 
全绿,`spotless:check` / `checkstyle:check` 干净。
   
   `git diff --check` 还报 trailing whitespace,但项目 spotless 强制方法间空行带 4 空格缩进 
(`./mvnw spotless:check` 失败如果把那 4 空格去掉),master 上既有文件就是这个格式,所以这条本仓库的 spotless 跟 
`git diff --check` 不兼容,我没法在不破 spotless 的前提下让 `git diff --check` 干净。


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