From bb9f3a95d263049983d4b756db8bddb6ae08e512 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Mon, 21 Jan 2019 15:17:33 -0600 Subject: [PATCH] move legacy field check to non-concurrent code --- executor.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/executor.go b/executor.go index c35d0276a..b17cf95e2 100644 --- a/executor.go +++ b/executor.go @@ -914,6 +914,12 @@ func (e *executor) executeGroupBy(ctx context.Context, index string, c *pql.Call // TODO support TopN in here would be really cool - and pretty easy I think. childRows := make([]RowIDs, len(c.Children)) for i, child := range c.Children { + // Check "field" first for backwards compatibility, then set _field. + // TODO: remove at Pilosa 2.0 + if fieldName, ok := child.Args["field"].(string); ok { + child.Args["_field"] = fieldName + } + if child.Name != "Rows" { return nil, errors.Errorf("'%s' is not a valid child query for GroupBy, must be 'Rows'", child.Name) } @@ -2767,11 +2773,6 @@ func newGroupByIterator(rowIDs []RowIDs, children []*pql.Call, filter *Row, inde var ok bool ignorePrev := false for i, call := range children { - // Check "field" first for backwards compatibility. - // TODO: remove at Pilosa 2.0 - if fieldName, ok = call.Args["field"].(string); ok { - call.Args["_field"] = fieldName - } if fieldName, ok = call.Args["_field"].(string); !ok { return nil, errors.Errorf("%s call must have field with valid (string) field name. Got %v of type %[2]T", call.Name, call.Args["_field"]) }