Skip to content

Commit 86681bd

Browse files
added filter for vector lengths
1 parent 25eae36 commit 86681bd

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

posting/index.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func (mp *MutationPipeline) ProcessList(ctx context.Context, pipeline *Predicate
316316
}
317317

318318
if info.count {
319-
if err := mp.ProcessCount(ctx, pipeline, &postings, info); err != nil {
319+
if err := mp.ProcessCount(ctx, pipeline, &postings, info, false); err != nil {
320320
return err
321321
}
322322
}
@@ -378,9 +378,15 @@ func (mp *MutationPipeline) ProcessReverse(ctx context.Context, pipeline *Predic
378378
}
379379

380380
if info.count {
381-
newInfo := info
382-
newInfo.isList = true
383-
return mp.ProcessCount(ctx, pipeline, &reverseredMap, newInfo)
381+
newInfo := predicateInfo{
382+
isList: true,
383+
index: info.index,
384+
reverse: info.reverse,
385+
count: info.count,
386+
noConflict: info.noConflict,
387+
hasUpsert: info.hasUpsert,
388+
}
389+
return mp.ProcessCount(ctx, pipeline, &reverseredMap, newInfo, true)
384390
}
385391

386392
for uid, pl := range reverseredMap {
@@ -469,9 +475,9 @@ func (txn *Txn) addConflictKeyWithUid(key []byte, pl *pb.PostingList, hasUpsert
469475
}
470476
}
471477

472-
func (mp *MutationPipeline) ProcessCount(ctx context.Context, pipeline *PredicatePipeline, postings *map[uint64]*pb.PostingList, info predicateInfo) error {
478+
func (mp *MutationPipeline) ProcessCount(ctx context.Context, pipeline *PredicatePipeline, postings *map[uint64]*pb.PostingList, info predicateInfo, isReverseEdge bool) error {
473479
dataKey := x.DataKey(pipeline.attr, 0)
474-
if info.reverse {
480+
if isReverseEdge {
475481
dataKey = x.ReverseKey(pipeline.attr, 0)
476482
}
477483
edge := pb.DirectedEdge{
@@ -548,7 +554,7 @@ func (mp *MutationPipeline) ProcessCount(ctx context.Context, pipeline *Predicat
548554

549555
for c, pl := range countMap {
550556
//fmt.Println("COUNT", c, pl)
551-
ck := x.CountKey(pipeline.attr, uint32(c), info.reverse)
557+
ck := x.CountKey(pipeline.attr, uint32(c), isReverseEdge)
552558
if newPl, err := mp.txn.AddDelta(string(ck), *pl); err != nil {
553559
return err
554560
} else {
@@ -660,7 +666,7 @@ func (mp *MutationPipeline) ProcessSingle(ctx context.Context, pipeline *Predica
660666

661667
if info.count {
662668
// Count should take care of updating the posting list
663-
return mp.ProcessCount(ctx, pipeline, &postings, info)
669+
return mp.ProcessCount(ctx, pipeline, &postings, info, false)
664670
}
665671

666672
baseKey := string(dataKey[:len(dataKey)-8]) // Avoid repeated conversion

0 commit comments

Comments
 (0)