Copilot commented on code in PR #9207:
URL: https://github.com/apache/gravitino/pull/9207#discussion_r2564879214


##########
core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/UserRoleRelPostgreSQLProvider.java:
##########
@@ -32,8 +32,7 @@ public class UserRoleRelPostgreSQLProvider extends 
UserRoleRelBaseSQLProvider {
   public String softDeleteUserRoleRelByUserId(Long userId) {
     return "UPDATE "
         + USER_ROLE_RELATION_TABLE_NAME
-        + " SET deleted_at = floor(extract(epoch from(current_timestamp -"
-        + " timestamp '1970-01-01 00:00:00')) * 1000)"
+        + " SET deleted_at = CAST(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000 
AS BIGINT)"

Review Comment:
   The PostgreSQL timestamp calculation is simplified but loses millisecond 
precision. `EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)` returns seconds as a double, 
which when multiplied by 1000 and cast to BIGINT may lose precision. Consider 
using `CAST(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000 + EXTRACT(MILLISECONDS 
FROM CURRENT_TIMESTAMP) % 1000 AS BIGINT)` to preserve millisecond accuracy.



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