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


##########
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 comment isn't quite right. `EXTRACT(EPOCH)` returns the time as a float, 
including the fractional seconds.
   
   If we use the suggested formula (multiplying the epoch and adding the 
milliseconds separately), we are effectively adding the milliseconds twice. The 
original code is safe because double precision is enough to hold the current 
timestamp without losing data.



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