Skip to content

Commit afe40cd

Browse files
yaacovCRrobrichard
authored andcommitted
adjust YieldSubsequentResults algorithm per review
1 parent 50f644d commit afe40cd

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
@@ -359,23 +359,21 @@ The procedure for yielding incremental results is specified by the
359359
YieldIncrementalResults(data, errors, incrementalDataRecords):
360360

361361
- Let {graph} be the result of {GraphFromRecords(incrementalDataRecords)}.
362-
- Let {pendingResults} be the result of {GetNonEmptyNewPending(graph)}.
363-
- Update {graph} to the subgraph rooted at nodes in {pendingResults}.
362+
- Let {rootNodes} be the result of {GetNewRootNodes(graph)}.
363+
- Update {graph} to the subgraph rooted at nodes in {rootNodes}.
364364
- Yield the result of {GetInitialResult(data, errors, pendingResults)}.
365365
- For each completed child Pending Incremental Data node of a root node in
366366
{graph}:
367367
- Let {incrementalDataRecord} be the Pending Incremental Data for that node;
368368
let {result} be the corresponding completed result.
369369
- If {data} on {result} is {null}:
370-
- Initialize {completed} to an empty list.
371370
- Let {parents} be the parent nodes of {executionGroup}.
372371
- Initialize {completed} to an empty list.
373-
- For each {pendingResult} of {parents}:
372+
- For each {node} of {parents}:
374373
- Append {GetCompletedEntry(parent, errors)} to {completed}.
375-
- Remove {pendingResult} and all of its descendant nodes from {graph},
376-
except for any descendant Incremental Data Record nodes with other
377-
parents.
378-
- Let {hasNext} be {false}, if {graph} is empty.
374+
- Remove {node} and all of its descendant nodes from {graph}, except for
375+
any descendant Incremental Data Record nodes with other parents.
376+
- Let {hasNext} be {false} if {graph} is empty; otherwise, {true}.
379377
- Yield an unordered map containing {completed} and {hasNext}.
380378
- Continue to the next completed Pending Incremental Data node.
381379
- Replace {node} in {graph} with a new node corresponding to the Completed
@@ -389,20 +387,21 @@ YieldIncrementalResults(data, errors, incrementalDataRecords):
389387
- If {completedIncrementalDataNodes} is empty, continue to the next completed
390388
Pending Incremental Data Node.
391389
- Initialize {incremental} to an empty list.
392-
- For each {node} of {completedIncrementalDataNodes}:
393-
- Let {incrementalDataRecord} be the corresponding record for {node}.
390+
- For each {completedIncrementalDataNode} of {completedIncrementalDataNodes}:
391+
- Let {incrementalDataRecord} be the corresponding record for
392+
{completedIncrementalDataNode}.
394393
- Append {GetIncrementalEntry(incrementalDataRecord, graph)} to
395394
{incremental}.
396395
- Remove {node} from {graph}.
397396
- Initialize {completed} to an empty list.
398-
- For each {pendingResult} of {completedDeferredFragments}:
399-
- Append {GetCompletedEntry(pendingResult)} to {completed}.
400-
- Remove {pendingResult} from {graph}, promoting its child Deferred Fragment
401-
nodes to root nodes.
402-
- Let {newPendingResults} be the result of {GetNonEmptyNewPending(graph)}.
403-
- Add all nodes in {newPendingResults} to {pendingResults}.
404-
- Update {graph} to the subgraph rooted at nodes in {pendingResults}.
405-
- Let {pending} be the result of {GetPendingEntry(newPendingResults)}.
397+
- For each {completedDeferredFragment} of {completedDeferredFragments}:
398+
- Append {GetCompletedEntry(completedDeferredFragment)} to {completed}.
399+
- Remove {completedDeferredFragment} from {graph}, promoting its child
400+
Deferred Fragment nodes to root nodes.
401+
- Let {newRootNodes} be the result of {GetNewRootNodes(graph)}.
402+
- Add all nodes in {newRootNodes} to {rootNodes}.
403+
- Update {graph} to the subgraph rooted at nodes in {rootNodes}.
404+
- Let {pending} be the result of {GetPendingEntry(newRootNodes)}.
406405
- Yield the result of {GetIncrementalResult(graph, incremental, completed,
407406
pending)}.
408407
- Complete this incremental result stream.
@@ -420,7 +419,7 @@ GraphFromRecords(incrementalDataRecords, graph):
420419
to {newGraph}, or the {parent} is not defined.
421420
- Return {newGraph}.
422421

423-
GetNonEmptyNewPending(graph):
422+
GetNewRootNodes(graph):
424423

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

0 commit comments

Comments
 (0)