From ffa065abc28638832f1b8807721c16ac442d9cd7 Mon Sep 17 00:00:00 2001 From: Nathaniel Cook Date: Tue, 29 May 2018 14:54:16 -0600 Subject: [PATCH] fix(query/functions/window): Fix window asignment bug --- query/functions/window.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/query/functions/window.go b/query/functions/window.go index 8d7c43a130..dd3f38a9a8 100644 --- a/query/functions/window.go +++ b/query/functions/window.go @@ -250,7 +250,8 @@ func (t *fixedWindowTransformation) Process(id execute.DatasetID, b query.Block) startColIdx := -1 stopColIdx := -1 for j, c := range b.Cols() { - keyed := b.Key().HasCol(c.Label) + keyIdx := execute.ColIdx(c.Label, b.Key().Cols()) + keyed := keyIdx >= 0 if c.Label == t.startColLabel { startColIdx = j keyed = true @@ -262,7 +263,7 @@ func (t *fixedWindowTransformation) Process(id execute.DatasetID, b query.Block) newCols = append(newCols, c) if keyed { keyCols = append(keyCols, c) - keyColMap = append(keyColMap, j) + keyColMap = append(keyColMap, keyIdx) } } if startColIdx == -1 { @@ -273,7 +274,7 @@ func (t *fixedWindowTransformation) Process(id execute.DatasetID, b query.Block) } newCols = append(newCols, c) keyCols = append(keyCols, c) - keyColMap = append(keyColMap, startColIdx) + keyColMap = append(keyColMap, len(keyColMap)) } if stopColIdx == -1 { stopColIdx = len(newCols) @@ -283,7 +284,7 @@ func (t *fixedWindowTransformation) Process(id execute.DatasetID, b query.Block) } newCols = append(newCols, c) keyCols = append(keyCols, c) - keyColMap = append(keyColMap, stopColIdx) + keyColMap = append(keyColMap, len(keyColMap)) } return b.Do(func(cr query.ColReader) error {