This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 069253bcd56 Adjust nanos writing in MySQL binary protocol to use 
microseconds (#37294)
069253bcd56 is described below

commit 069253bcd56be5944edbd786178959e10cb08ebb
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Dec 7 23:32:32 2025 +0800

    Adjust nanos writing in MySQL binary protocol to use microseconds (#37294)
    
    * Adjust nanos writing in MySQL binary protocol to use microseconds
    
    * Adjust nanos writing in MySQL binary protocol to use microseconds
---
 RELEASE-NOTES.md                                                        | 1 +
 .../query/binary/execute/protocol/MySQLDateBinaryProtocolValue.java     | 2 +-
 .../query/binary/execute/protocol/MySQLTimeBinaryProtocolValue.java     | 2 +-
 .../query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java | 2 +-
 .../query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index ea018db9cb2..78407b4545b 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -96,6 +96,7 @@
 1. Proxy: Fix column length for PostgreSQL string binary protocol value - 
[35840](https://github.com/apache/shardingsphere/pull/35840)
 1. Proxy: Fix the connection leak caused by rollback failure in Proxy - 
[35867](https://github.com/apache/shardingsphere/pull/35867)
 1. Proxy: Fix the behavior difference of select built-in function names with 
spaces -[#36537](https://github.com/apache/shardingsphere/pull/36537)
+1. Proxy: Fix MySQL binary protocol datetime/time fractional seconds precision 
- [#37294](https://github.com/apache/shardingsphere/pull/37294)
 1. Proxy: Fix PostgreSQL boolean text output to return `t`/`f` as per protocol 
- [#37184](https://github.com/apache/shardingsphere/pull/37184)
 1. Mode: Fix issue of drop schema can not work on standalone mode - 
[#34470](https://github.com/apache/shardingsphere/pull/34470)
 1. Encrypt: Resolve rewrite issue in nested concat function - 
[#35815](https://github.com/apache/shardingsphere/pull/35815)
diff --git 
a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValue.java
 
b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValue.java
index 95dbe2e8859..b394db91695 100644
--- 
a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValue.java
+++ 
b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValue.java
@@ -111,6 +111,6 @@ public final class MySQLDateBinaryProtocolValue implements 
MySQLBinaryProtocolVa
     }
     
     private void writeNanos(final MySQLPacketPayload payload, final int nanos) 
{
-        payload.writeInt4(nanos);
+        payload.writeInt4(nanos / 1000);
     }
 }
diff --git 
a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValue.java
 
b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValue.java
index 5ffc2451ff8..8e5fa3ae3ab 100644
--- 
a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValue.java
+++ 
b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValue.java
@@ -89,6 +89,6 @@ public final class MySQLTimeBinaryProtocolValue implements 
MySQLBinaryProtocolVa
     }
     
     private void writeNanos(final MySQLPacketPayload payload, final int nanos) 
{
-        payload.writeInt4(nanos);
+        payload.writeInt4(nanos / 1000);
     }
 }
diff --git 
a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
 
b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
index 848fb2e5a8e..32aa2a265c2 100644
--- 
a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
+++ 
b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDateBinaryProtocolValueTest.java
@@ -148,6 +148,6 @@ class MySQLDateBinaryProtocolValueTest {
         verify(payload).writeInt1(12);
         verify(payload).writeInt1(10);
         verify(payload).writeInt1(30);
-        verify(payload).writeInt4(100000000);
+        verify(payload).writeInt4(100000);
     }
 }
diff --git 
a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
 
b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
index 7dec3de7acb..baee0bfddd0 100644
--- 
a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
+++ 
b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLTimeBinaryProtocolValueTest.java
@@ -103,6 +103,6 @@ class MySQLTimeBinaryProtocolValueTest {
         verify(payload, atLeastOnce()).writeInt1(12);
         verify(payload, times(5)).writeInt1(anyInt());
         verify(payload).writeInt4(0);
-        verify(payload).writeInt4(1000000);
+        verify(payload).writeInt4(1000);
     }
 }

Reply via email to