zhang-arvin opened a new pull request, #67359:
URL: https://github.com/apache/doris/pull/67359

   ## Proposed changes
   
   Fix FE reports hardcoded field length 255 for all VARCHAR columns in the 
MySQL protocol column definition packet.
   
   ### Problem
   When connecting via MySQL connector/ODBC, VARCHAR columns always show length 
255 instead of the actual defined length. The `getMysqlTypeLength` method in 
`MysqlSerializer` had a hardcoded `return 255` in the default case for 
VARCHAR/CHAR/STRING types, ignoring the actual type length.
   
   ### Solution
   Added explicit cases for `VARCHAR`, `CHAR`, and `STRING` in 
`getMysqlTypeLength` to return `type.getLength()` instead of the hardcoded 255. 
This reports the actual column length (e.g., 10 for VARCHAR(10)) in the MySQL 
protocol column definition packet.
   
   ### Changes
   - `fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlSerializer.java`: 
Added explicit cases for VARCHAR, CHAR, STRING to return actual type length
   - 
`fe/fe-core/src/test/java/org/apache/doris/mysql/MysqlSerializerVarbinaryTest.java`:
 Updated test to expect actual VARCHAR length (10) instead of 255
   
   Issue: #67349


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to