You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Yicong-Huang (via GitHub)" <gi...@apache.org> on 2026/05/25 23:36:17 UTC
[I] tryGetExistingExecution returns Some(null) instead of None for missing eid [texera]
Yicong-Huang opened a new issue, #5211:
URL: https://github.com/apache/texera/issues/5211
### Bug Description
`org.apache.texera.web.service.ExecutionsMetadataPersistService.tryGetExistingExecution` (`amber/src/main/scala/org/apache/texera/web/service/ExecutionsMetadataPersistService.scala:78`) breaks the `Option[T]` contract for the lookup-miss case:
```scala
def tryGetExistingExecution(executionId: ExecutionIdentity): Option[WorkflowExecutions] = {
try {
Some(workflowExecutionsDao.fetchOneByEid(executionId.id.toInt))
} catch {
case t: Throwable =>
logger.info("Unable to get execution. Error = " + t.getMessage)
None
}
}
```
`fetchOneByEid` returns `null` when no row matches; that `null` is wrapped in `Some(...)` and returned. The `catch` only triggers on hard errors (e.g. a closed connection). Callers using `getOrElse` will get the `null` through and NPE later.
### Reproduction
`amber/src/test/scala/org/apache/texera/web/service/ExecutionsMetadataPersistServiceSpec.scala` (introduced in the linked PR) pins this:
```scala
ExecutionsMetadataPersistService.tryGetExistingExecution(ExecutionIdentity(-1L))
// returns Some(null), not None
```
Version: 1.1.0-incubating.
### Suggested direction
Wrap in `Option(...)`:
```scala
Option(workflowExecutionsDao.fetchOneByEid(executionId.id.toInt))
```
(also re-evaluate whether the catch-all still adds value once the miss case is handled correctly).
--
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: notifications-unsubscribe@texera.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] tryGetExistingExecution returns Some(null) instead of None for missing eid [texera]
Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on issue #5211:
URL: https://github.com/apache/texera/issues/5211#issuecomment-4539131106
/take
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] tryGetExistingExecution returns Some(null) instead of None for missing eid [texera]
Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang closed issue #5211: tryGetExistingExecution returns Some(null) instead of None for missing eid
URL: https://github.com/apache/texera/issues/5211
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org