sshiv012 opened a new pull request, #9272:
URL: https://github.com/apache/texera/pull/9272

   > **Stacked on #9271.** This branch contains #9271's commit. Review only the 
last commit, `feat: send live result updates of every output port`, or [its 
diff](https://github.com/sshiv012/texera/compare/sshiv012/result-port-1-store...sshiv012/result-port-2-live-updates).
 I'll rebase once #9271 merges.
   
   ### What changes were proposed in this PR?
   
   #9054 lets a pagination request read any output port, but the live result 
updates still follow only an operator's first port. The frontend therefore 
can't tell that a later port has a result (a Split's second output, or a port 
holding a visualization) or that it changed. #9054 deliberately left live 
updates on the first port. This PR is the proposal to extend them, so feedback 
on the shape is welcome.
   
   **Backend**
   - `WebResultUpdateEvent` gains a third field, `portUpdates: Map[String, 
Map[Int, WebResultUpdate]]` (operator id → port index → update), e.g. 
`"portUpdates": {"Split-1": {"1": {...}}}`.
   - It holds the ports past the first whose result is new or whose tuple count 
changed, using the same rule as the first port.
   - `updates` and `tableStats` keep their exact meaning: the first port only. 
Later ports get no table statistics.
   - Each port's update is built with that port's own output mode and document. 
For example, an HTML port 1 next to a table port 0 sends a snapshot, and a 
`SET_DELTA` port 1 sends only the rows added since its own previous count.
   
   **Frontend (`WorkflowResultService` only; no UI change)**
   - Keeps a table service or a visualization service per later port, fed by 
`portUpdates`.
     - A port's table service is created from its live updates even when port 0 
is not a table.
     - `getPortPaginatedResultService` returns `undefined` for a port that 
holds a visualization.
   - Emits on `getResultInitiateStream()` when a later port's result appears, 
or switches between table and visualization.
   - New `getResultPortIndices(op)`: the ports that currently have a result. 
New `getPortResultService(op, n)` and `getPortResultUpdateStream()`.
   - `determineOutputTypes` and `determineOutputExtension` take an optional 
`portIndex`. Port 0 behaves as before.
   - An event without `portUpdates` (from an older server) is accepted.
   
   The result panel still shows the first port. Showing later ports is a 
separate PR, to be coordinated with #9052.
   
   ### Any related issues, documentation, discussions?
   
   Stacked on #9271. Builds on #9054. Part of discussion #8914. Related to 
#9052 (pinned windows).
   
   ### How was this PR tested?
   
   Backend specs in `ExecutionResultServiceSpec`:
   - a later port's update goes in `portUpdates`, never in `updates`;
   - only the later ports whose count changed are sent, and an operator with no 
changed later port has no key;
   - a moved change detector with an unchanged count is not resent;
   - a later port uses its own output mode and document: an HTML snapshot, a 
table behind an HTML first port, and `SET_DELTA` rows counted from that port's 
own previous count;
   - a later port that is not stored yet gets an empty pagination update.
   
   `TexeraWebSocketEventSpec` checks the `portUpdates` JSON shape.
   
   Frontend specs in `workflow-result.service.spec.ts` (+364 lines):
   - services are created and fed per port, and a port switching between table 
and visualization is handled and announced;
   - `getResultPortIndices` order, `determineOutputTypes` per port, and 
`clearResults`;
   - events without `portUpdates` are accepted.
   
   ```
   sbt "WorkflowExecutionService/testOnly *ExecutionResultServiceSpec 
*WorkflowServiceSpec *TexeraWebSocketEventSpec"
   sbt "WorkflowExecutionService/scalafmtCheck" 
"WorkflowExecutionService/Test/scalafmtCheck" 
"WorkflowExecutionService/scalafixAll --check"
   cd frontend && npx ng test --watch=false     # 248 files, 7039 passed
   npx prettier --check src/app/workspace/service/workflow-result/*.ts 
src/app/workspace/types/execute-workflow.interface.ts
   ```
   
   All pass except the two `WorkflowServiceSpec` cases noted in #9271, which 
fail the same way on `main` ("a warehouse must be selected for this execution").
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01SRmgtBces67YppgKLHoZHa
   


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