Skip to content

Commit 359441e

Browse files
committed
adjust YieldSubsequentResults algorithm per review
1 parent a67def4 commit 359441e

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

spec/Section 6 -- Execution.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -356,23 +356,21 @@ The procedure for yielding incremental results is specified by the
356356
YieldIncrementalResults(data, errors, incrementalDataRecords):
357357

358358
- Let {graph} be the result of {GraphFromRecords(incrementalDataRecords)}.
359-
- Let {pendingResults} be the result of {GetNonEmptyNewPending(graph)}.
360-
- Update {graph} to the subgraph rooted at nodes in {pendingResults}.
359+
- Let {rootNodes} be the result of {GetNewRootNodes(graph)}.
360+
- Update {graph} to the subgraph rooted at nodes in {rootNodes}.
361361
- Yield the result of {GetInitialResult(data, errors, pendingResults)}.
362362
- For each completed child Pending Incremental Data node of a root node in
363363
{graph}:
364364
- Let {incrementalDataRecord} be the Pending Incremental Data for that node;
365365
let {result} be the corresponding completed result.
366366
- If {data} on {result} is {null}:
367-
- Initialize {completed} to an empty list.
368367
- Let {parents} be the parent nodes of {executionGroup}.
369368
- Initialize {completed} to an empty list.
370-
- For each {pendingResult} of {parents}:
369+
- For each {node} of {parents}:
371370
- Append {GetCompletedEntry(parent, errors)} to {completed}.
372-
- Remove {pendingResult} and all of its descendant nodes from {graph},
373-
except for any descendant Incremental Data Record nodes with other
374-
parents.
375-
- Let {hasNext} be {false}, if {graph} is empty.
371+
- Remove {node} and all of its descendant nodes from {graph}, except for
372+
any descendant Incremental Data Record nodes with other parents.
373+
- Let {hasNext} be {false} if {graph} is empty; otherwise, {true}.
376374
- Yield an unordered map containing {completed} and {hasNext}.
377375
- Continue to the next completed Pending Incremental Data node.
378376
- Replace {node} in {graph} with a new node corresponding to the Completed
@@ -386,20 +384,21 @@ YieldIncrementalResults(data, errors, incrementalDataRecords):
386384
- If {completedIncrementalDataNodes} is empty, continue to the next completed
387385
Pending Incremental Data Node.
388386
- Initialize {incremental} to an empty list.
389-
- For each {node} of {completedIncrementalDataNodes}:
390-
- Let {incrementalDataRecord} be the corresponding record for {node}.
387+
- For each {completedIncrementalDataNode} of {completedIncrementalDataNodes}:
388+
- Let {incrementalDataRecord} be the corresponding record for
389+
{completedIncrementalDataNode}.
391390
- Append {GetIncrementalEntry(incrementalDataRecord, graph)} to
392391
{incremental}.
393392
- Remove {node} from {graph}.
394393
- Initialize {completed} to an empty list.
395-
- For each {pendingResult} of {completedDeferredFragments}:
396-
- Append {GetCompletedEntry(pendingResult)} to {completed}.
397-
- Remove {pendingResult} from {graph}, promoting its child Deferred Fragment
398-
nodes to root nodes.
399-
- Let {newPendingResults} be the result of {GetNonEmptyNewPending(graph)}.
400-
- Add all nodes in {newPendingResults} to {pendingResults}.
401-
- Update {graph} to the subgraph rooted at nodes in {pendingResults}.
402-
- Let {pending} be the result of {GetPendingEntry(newPendingResults)}.
394+
- For each {completedDeferredFragment} of {completedDeferredFragments}:
395+
- Append {GetCompletedEntry(completedDeferredFragment)} to {completed}.
396+
- Remove {completedDeferredFragment} from {graph}, promoting its child
397+
Deferred Fragment nodes to root nodes.
398+
- Let {newRootNodes} be the result of {GetNewRootNodes(graph)}.
399+
- Add all nodes in {newRootNodes} to {rootNodes}.
400+
- Update {graph} to the subgraph rooted at nodes in {rootNodes}.
401+
- Let {pending} be the result of {GetPendingEntry(newRootNodes)}.
403402
- Yield the result of {GetIncrementalResult(graph, incremental, completed,
404403
pending)}.
405404
- Complete this incremental result stream.
@@ -417,7 +416,7 @@ GraphFromRecords(incrementalDataRecords, graph):
417416
to {newGraph}, or the {parent} is not defined.
418417
- Return {newGraph}.
419418

420-
GetNonEmptyNewPending(graph):
419+
GetNewRootNodes(graph):
421420

422421
- Initialize {newPendingResults} to the empty set.
423422
- Initialize {rootNodes} to the set of root nodes in {graph}.

0 commit comments

Comments
 (0)