Skip to content

Commit c796f03

Browse files
committed
bring BuildFieldPlan in line with implementation
1 parent a4b506c commit c796f03

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

spec/Section 6 -- Execution.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -627,27 +627,41 @@ directives may be applied in either order since they apply commutatively.
627627
BuildFieldPlan(originalGroupedFieldSet, parentDeferUsages):
628628

629629
- If {parentDeferUsages} is not provided, initialize it to the empty set.
630-
- Initialize {fieldPlan} to an empty ordered map.
630+
- Initialize {groupedFieldSet} to an empty ordered map.
631+
- Initialize {newGroupedFieldSets} to an empty unordered map.
632+
- Let {fieldPlan} be an unordered map containing {groupedFieldSet} and
633+
{newGroupedFieldSets}.
631634
- For each {responseKey} and {groupForResponseKey} of {groupedFieldSet}:
632-
- Let {deferUsageSet} be the result of
633-
{GetDeferUsageSet(groupForResponseKey)}.
634-
- Let {groupedFieldSet} be the entry in {fieldPlan} for any equivalent set to
635-
{deferUsageSet}; if no such map exists, create it as an empty ordered map.
636-
- Set the entry for {responseKey} in {groupedFieldSet} to
637-
{groupForResponseKey}.
635+
- Let {filteredDeferUsageSet} be the result of
636+
{GetFilteredDeferUsageSet(groupForResponseKey)}.
637+
- If {filteredDeferUsageSet} is the equivalent set to {parentDeferUsages}:
638+
- Set the entry for {responseKey} in {groupedFieldSet} to
639+
{groupForResponseKey}.
640+
- Otherwise:
641+
- Let {newGroupedFieldSet} be the entry in {newGroupedFieldSets} for any
642+
equivalent set to {deferUsageSet}; if no such map exists, create it as an
643+
empty ordered map.
644+
- Set the entry for {responseKey} in {newGroupedFieldSet} to
645+
{groupForResponseKey}.
638646
- Return {fieldPlan}.
639647

640-
GetDeferUsageSet(fieldDetailsList):
641-
642-
- Let {deferUsageSet} be the set containing the {deferUsage} entry from each
643-
item in {fieldDetailsList}.
644-
- For each {deferUsage} of {deferUsageSet}:
645-
- Let {ancestors} be the set of {deferUsage} entries that are ancestors of
646-
{deferUsage}, collected by recursively following the {parent} entry on
647-
{deferUsage}.
648-
- If any of {ancestors} is contained by {deferUsageSet}, remove {deferUsage}
649-
from {deferUsageSet}.
650-
- Return {deferUsageSet}.
648+
GetFilteredDeferUsageSet(fieldGroup):
649+
650+
- Initialize {filteredDeferUsageSet} to the empty set.
651+
- For each {fieldDetails} of {fieldGroup}:
652+
- Let {deferUsage} be the corresponding entry on {fieldDetails}.
653+
- If {deferUsage} is not defined:
654+
- Remove all entries from {filteredDeferUsageSet}.
655+
- Return {filteredDeferUsageSet}.
656+
- Add {deferUsage} to {filteredDeferUsageSet}.
657+
- For each {deferUsage} in {filteredDeferUsageSet}:
658+
- Let {parentDeferUsage} be the corresponding entry on {deferUsage}.
659+
- While {parentDeferUsage} is defined:
660+
- If {parentDeferUsage} is contained by {filteredDeferUsageSet}:
661+
- Remove {deferUsage} from {filteredDeferUsageSet}.
662+
- Continue to the next {deferUsage} in {filteredDeferUsageSet}.
663+
- Reset {parentDeferUsage} to the corresponding entry on {parentDeferUsage}.
664+
- Return {filteredDeferUsageSet}.
651665

652666
## Executing a Field Plan
653667

@@ -661,9 +675,8 @@ variableValues, serial, path, deferUsageSet, deferMap):
661675
- If {path} is not provided, initialize it to an empty list.
662676
- Let {newDeferMap} be the result of {GetNewDeferMap(newDeferUsages, path,
663677
deferMap)}.
664-
- Let {groupedFieldSet} be the entry in {fieldPlan} for the set equivalent to
665-
{deferUsageSet}.
666-
- Let {newGroupedFieldSets} be the remaining portion of {fieldPlan}.
678+
- Let {groupedFieldSet} and {newGroupedFieldSets} be the corresponding entries
679+
on {fieldPlan}.
667680
- Allowing for parallelization, perform the following steps:
668681
- Let {data} and {nestedIncrementalDataRecords} be the result of running
669682
{ExecuteGroupedFieldSet(groupedFieldSet, objectType, objectValue,

0 commit comments

Comments
 (0)