From 77a81eb2e11bf65700c5b481c82ce5d940186bd2 Mon Sep 17 00:00:00 2001 From: Travis Date: Tue, 29 Oct 2019 14:26:08 -0500 Subject: [PATCH] fix bug preventing a Rows() query on a bool field --- executor.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/executor.go b/executor.go index 1b466b1b6..50ed7f89e 100644 --- a/executor.go +++ b/executor.go @@ -2676,15 +2676,20 @@ func (e *executor) translateCall(index string, idx *Index, c *pql.Call) error { // are only two possible values. Instead, they are handled // directly. if field.Type() == FieldTypeBool { - boolVal, err := callArgBool(c, rowKey) - if err != nil { - return errors.Wrap(err, "getting bool key") + // TODO: This code block doesn't make sense for a `Rows()` + // queries on a `bool` field. Need to review this better, + // include it in tests, and probably back-port it to Pilosa. + if c.Name != "Rows" { + boolVal, err := callArgBool(c, rowKey) + if err != nil { + return errors.Wrap(err, "getting bool key") + } + rowID := falseRowID + if boolVal { + rowID = trueRowID + } + c.Args[rowKey] = rowID } - rowID := falseRowID - if boolVal { - rowID = trueRowID - } - c.Args[rowKey] = rowID } else if field.keys() { if c.Args[rowKey] != nil && !isString(c.Args[rowKey]) { return errors.New("row value must be a string when field 'keys' option enabled")