mengw15 commented on code in PR #6017:
URL: https://github.com/apache/texera/pull/6017#discussion_r3619985396
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/WorkflowSearchQueryBuilder.scala:
##########
@@ -150,10 +153,10 @@ object WorkflowSearchQueryBuilder extends
SearchQueryBuilder {
val pidField = groupConcatDistinct(WORKFLOW_OF_PROJECT.PID)
val dw = DashboardWorkflow(
record.into(WORKFLOW_OF_USER).getUid.eq(uid),
- record
- .get(WORKFLOW_USER_ACCESS.PRIVILEGE)
- .toString,
- record.into(USER).getName,
+ Option(record.get(WORKFLOW_USER_ACCESS.PRIVILEGE,
classOf[PrivilegeEnum]))
+ .map(_.toString)
+ .getOrElse("NONE"),
Review Comment:
#6016 returns `PrivilegeEnum.NONE` here rather than the string `"NONE"`.
`PrivilegeEnum` has a `NONE` value, so dropping `.map(_.toString)` and using
`.getOrElse(PrivilegeEnum.NONE)` keeps the two fixes consistent and type-safe
(the field type is `PrivilegeEnum`).
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/WorkflowSearchQueryBuilder.scala:
##########
@@ -81,7 +84,7 @@ object WorkflowSearchQueryBuilder extends SearchQueryBuilder {
condition = WORKFLOW.IS_PUBLIC.eq(true)
} else {
val privateAccessCondition =
- WORKFLOW_USER_ACCESS.UID.eq(uid).or(PROJECT_USER_ACCESS.UID.eq(uid))
+ WORKFLOW_USER_ACCESS.UID.eq(uid).or(PROJECT_USER_ACCESS.UID.isNotNull)
Review Comment:
Two consistency points vs the sibling dataset fix (#6016), which took this
change as a chance to rewrite the block cleanly. (1) The `var condition:
Condition = DSL.trueCondition()` initializer just above is now dead — every
branch reassigns it; #6016 made it a `val condition = if…else` with no seed.
(2) This line mixes forms: `WORKFLOW_USER_ACCESS.UID.eq(uid)` vs
`PROJECT_USER_ACCESS.UID.isNotNull`. Both are correct (once `uid` is in the ON
clause, `WORKFLOW_USER_ACCESS.UID` is either `uid` or null, so the two are
equivalent), but the asymmetry reads oddly and `.eq(uid)` quietly depends on
the ON-clause filter staying in place; #6016 uses `isNotNull` on both sides.
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/WorkflowSearchQueryBuilder.scala:
##########
@@ -150,10 +153,10 @@ object WorkflowSearchQueryBuilder extends
SearchQueryBuilder {
val pidField = groupConcatDistinct(WORKFLOW_OF_PROJECT.PID)
val dw = DashboardWorkflow(
record.into(WORKFLOW_OF_USER).getUid.eq(uid),
- record
- .get(WORKFLOW_USER_ACCESS.PRIVILEGE)
- .toString,
- record.into(USER).getName,
+ Option(record.get(WORKFLOW_USER_ACCESS.PRIVILEGE,
classOf[PrivilegeEnum]))
+ .map(_.toString)
+ .getOrElse("NONE"),
+ Option(record.into(USER).getName).getOrElse(""),
Review Comment:
Are these two null-safe fallbacks needed? The `USER` join is `ON
WORKFLOW_OF_USER.UID` and wasn't touched by this PR — only the access-table
join predicates moved — so the owner `USER` columns shouldn't go null. #6016
keeps `owner.getEmail` unguarded on the same-shaped change and passes CI, which
suggests the owner is always present; if so, PRIVILEGE just above is the only
column that actually goes null here. The `getUid` fallback of `0` is the
riskier one: 0 isn't a real uid, so if the frontend uses the owner id for
navigation it would silently point at a non-existent user rather than fail
loudly.
--
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]