carloea2 commented on code in PR #4181:
URL: https://github.com/apache/texera/pull/4181#discussion_r2749164567
##########
file-service/src/main/scala/org/apache/texera/service/resource/DatasetResource.scala:
##########
@@ -1487,11 +1495,38 @@ class DatasetResource {
dataset
}
+ private def listMultipartUploads(did: Integer, requesterUid: Int): Response
= {
+ withTransaction(context) { ctx =>
+ if (!userHasWriteAccess(ctx, did, requesterUid)) {
+ throw new ForbiddenException(ERR_USER_HAS_NO_ACCESS_TO_DATASET_MESSAGE)
+ }
+
+ val filePaths =
+ ctx
+ .selectDistinct(DATASET_UPLOAD_SESSION.FILE_PATH)
+ .from(DATASET_UPLOAD_SESSION)
+ .where(DATASET_UPLOAD_SESSION.DID.eq(did))
+ .and(
+ DSL.condition(
+ "created_at > current_timestamp - (? * interval '1 hour')",
Review Comment:
I think they are the same, here is my believe if I am wrong let me know:
`created_at `is a `timestamptz`. In PostgreSQL, `timestamptz `values
represent an absolute instant (stored internally in UTC).
On the Scala side,` createdAt: OffsetDateTime = session.getCreatedAt` comes
from the database as an OffsetDateTime that represents the same instant. We add
the expiration duration and compare it against “`now`” constructed with the
same offset:
`createdAt.plusHours(expHrs).isBefore(OffsetDateTime.now(createdAt.getOffset))`
The only subtle difference is:
SQL uses `current_timestamp `(typically fixed at transaction start in
Postgres).
Scala uses the app server’s clock at call time.
--
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]