Asthenia0412 opened a new pull request, #67960: URL: https://github.com/apache/doris/pull/67960
## Proposed changes When a `TIMESTAMPTZ` column is queried through a non-JDBC client (for example golang `database/sql`), the MySQL column definition packet advertises `MYSQL_TYPE_STRING`, so drivers report `DatabaseTypeName` as `char` instead of `TIMESTAMP`. This breaks type-based scanning into `time.Time`. Binary result rows also have no `TIMESTAMPTZ` handling. This PR fixes the MySQL protocol for `TIMESTAMPTZ`: - `PrimitiveType.toMysqlType()` now maps `TIMESTAMPTZ` to `MYSQL_TYPE_TIMESTAMP` (same semantics as MySQL `TIMESTAMP`: an instant rendered in the session time zone). - `MysqlSerializer.getMysqlDecimals()` reports the decimal scale for `TIMESTAMPTZ`. - `MysqlResultSender.sendBinaryResultRow()` encodes `TIMESTAMPTZ` values as MySQL `TIMESTAMP` binary format, dropping the trailing timezone offset (the wall-clock part is already rendered in the session time zone). `TIMESTAMP_NS` stays as a string because nanoseconds cannot be represented by any MySQL temporal type. ## Further comments Unit tests added in `MysqlSerializerDateTimeTest`: - `testTimestampTzMetadata`: field packet advertises `MYSQL_TYPE_TIMESTAMP` and correct decimals. - `testTimestampTzTypeMapping`: `PrimitiveType.TIMESTAMPTZ.toMysqlType()` returns `MYSQL_TYPE_TIMESTAMP`; `TIMESTAMP_NS` stays `MYSQL_TYPE_STRING`. -- 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]
