From e3f4eab5ac05007fead5d4e7316fe75efd3d83e4 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Fri, 27 Jan 2017 18:42:47 -0500 Subject: [PATCH] removed maxslice from setbit path --- executor.go | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/executor.go b/executor.go index 3a8152ff5..f97c35c79 100644 --- a/executor.go +++ b/executor.go @@ -52,13 +52,15 @@ func (e *Executor) Execute(ctx context.Context, db string, q *pql.Query, slices // If slices aren't specified, then include all of them. if len(slices) == 0 { - // Round up the number of slices. - maxSlice := e.Index.DB(db).MaxSlice() + if needsSlices(q.Calls){ + // Round up the number of slices. +maxSlice := e.Index.DB(db).MaxSlice() - // Generate a slices of all slices. - slices = make([]uint64, maxSlice+1) - for i := range slices { - slices[i] = uint64(i) + // Generate a slices of all slices. + slices = make([]uint64, maxSlice+1) + for i := range slices { + slices[i] = uint64(i) + } } } @@ -876,3 +878,21 @@ func hasOnlySetBitmapAttrs(calls pql.Calls) bool { } return true } + +func needsSlices(calls pql.Calls) bool { + if len(calls) == 0 { + return false + } + + for _, call := range calls { + if _, ok := call.(pql.BitmapCall); !ok { + return true + }else if _, ok := call.(*pql.Count); !ok { + return true + }else if _, ok := call.(*pql.TopN); !ok { + return true + } + + } + return false +}