MCPcopy
hub / github.com/dgraph-io/dgraph / updateDestUids

Method updateDestUids

query/query.go:2594–2609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2592}
2593
2594func (sg *SubGraph) updateDestUids() {
2595 // Update sg.destUID. Iterate over the UID matrix (which is not sorted by
2596 // UID). For each element in UID matrix, we do a binary search in the
2597 // current destUID and mark it. Then we scan over this bool array and
2598 // rebuild destUIDs.
2599 included := make([]bool, len(sg.DestUIDs.Uids))
2600 for _, ul := range sg.uidMatrix {
2601 for _, uid := range ul.Uids {
2602 idx := algo.IndexOf(sg.DestUIDs, uid) // Binary search.
2603 if idx >= 0 {
2604 included[idx] = true
2605 }
2606 }
2607 }
2608 algo.ApplyFilter(sg.DestUIDs, func(uid uint64, idx int) bool { return included[idx] })
2609}
2610
2611func (sg *SubGraph) sortAndPaginateUsingFacet(ctx context.Context) error {
2612 if len(sg.facetsMatrix) == 0 {

Callers 4

expandRecurseMethod · 0.80

Calls 2

IndexOfFunction · 0.92
ApplyFilterFunction · 0.92

Tested by

no test coverage detected