kunwp1 commented on code in PR #9493:
URL: https://github.com/apache/texera/pull/9493#discussion_r4594103517
##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/warehouse/WarehouseResource.scala:
##########
@@ -212,7 +213,7 @@ class WarehouseResource(client: LakekeeperClient, enabled:
Boolean) extends Lazy
try {
row.store()
// created_at is filled by the DB default; fetch it back before
serializing.
- row.refresh()
+ row.refresh(dashboardFields: _*)
Review Comment:
`create` sets every other field itself (`whid` is drawn up front), so only
`created_at` comes from the DB here. `row.refresh(USER_WAREHOUSE.CREATED_AT)`
would match the comment above, and it leaves `dashboardFields` used only by
`status`, so it can be a plain `val`.
The new single-column lookups, here in `delete` and in
`WorkflowService.resolveLakekeeperWarehouseName`, can also read the value
directly with `.fetchOne(USER_WAREHOUSE.LAKEKEEPER_WAREHOUSE_ID)` instead of a
`Record1` and `value1()`. Both columns are NOT NULL, so a null result still
means "no row".
##########
amber/src/main/scala/org/apache/texera/web/service/ResultExportService.scala:
##########
@@ -135,10 +129,7 @@ class ResultExportService(workflowIdentity:
WorkflowIdentity, computingUnitId: I
def exportToLocal(request: ResultExportRequest): Response = {
if (request.operators.size > 1) {
val (zipStream, zipFileNameOpt) = exportOperatorsAsZip(request)
- if (zipStream == null) {
- throw new RuntimeException("Zip stream is null")
- }
- val fileName = zipFileNameOpt.getOrElse("operators.zip")
+ val fileName = zipFileNameOpt.get
Review Comment:
Both `.get`s are safe only because `exportOperatorsAsZip` always returns
`Some(name)` and `exportOperatorResultAsStream` pairs `null` with `None`. Could
the types say that instead? Returning `(StreamingOutput, String)` for the zip
and `Option[(StreamingOutput, String)]` for one operator removes both `.get`s
and the null check:
```scala
val (streamingOutput, fileName) =
exportOperatorResultAsStream(request, op)
.getOrElse(throw new RuntimeException("Failed to export operator"))
```
The spec's "no stream" cases then become `... shouldBe None`. Separately,
`streamDocumentAsParquetZip` could be
`Using.resource(doc.asInputStream())(IOUtils.copy(_, outputStream))`, the same
way this file already handles the zip.
##########
amber/src/main/scala/org/apache/texera/web/service/WorkflowService.scala:
##########
@@ -177,22 +176,6 @@ class WorkflowService(
}
)
- var lastCompletedLogicalPlan: Option[LogicalPlan] = Option.empty
-
- executionService.subscribe { executionService: WorkflowExecutionService =>
- {
- executionService.executionStateStore.metadataStore.registerDiffHandler {
- (oldState, newState) =>
- {
- if (oldState.state != COMPLETED && newState.state == COMPLETED) {
- lastCompletedLogicalPlan =
Option.apply(executionService.workflow.logicalPlan)
- }
- Iterable.empty
- }
- }
- }
- }
Review Comment:
`WorkflowServiceSpec` still has a "deliberately not covered" bullet for
`lastCompletedLogicalPlan` and this `subscribe` block (lines 147-152), so it
can go along with them.
--
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]