You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "thswlsqls (via GitHub)" <gi...@apache.org> on 2026/07/15 12:58:28 UTC

[I] Microseconds decoded as nanoseconds in MySQL binary TIME value [shardingsphere]

thswlsqls opened a new issue, #39135:
URL: https://github.com/apache/shardingsphere/issues/39135

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master @ 7568693e8ee
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   Proxy
   
   ### Expected behavior
   
   When ShardingSphere-Proxy decodes a MySQL binary-protocol `TIME` value carrying a fractional second, the resulting `Timestamp` should carry the full sub-second value (e.g. 230000 microseconds on the wire yields 230,000,000 nanoseconds).
   
   ### Actual behavior
   
   The 4-byte fractional field holds microseconds, but `read()` passes it straight to `Timestamp#setNanos`, which expects nanoseconds. The value is decoded 1000x too small, so 230000 microseconds becomes 230,000 nanoseconds and the fractional second is lost.
   
   ### Reason analyze (If you can)
   
   In `MySQLTimeBinaryProtocolValue.read()` (case 12) `result.setNanos(payload.readInt4())` omits the microseconds-to-nanoseconds conversion. The sibling `MySQLDateBinaryProtocolValue.read()` already does `readInt4() * 1000`, and the same class `writeNanos()` writes `nanos / 1000`, so the read path must reverse it with `* 1000`.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   Send a MySQL binary-protocol `TIME` value with a non-zero fractional second (length 12 packet) through the proxy; the decoded `Timestamp` nanos are 1000x smaller than sent.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   N/A
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Microseconds decoded as nanoseconds in MySQL binary TIME value [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #39135: Microseconds decoded as nanoseconds in MySQL binary TIME value
URL: https://github.com/apache/shardingsphere/issues/39135


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org