processBinaryBoolean handles the binary operands which return a boolean value. All the inequality operators (<, >, <=, >=, !=, ==)
(mNode *mathTree)
| 181 | // return a boolean value. |
| 182 | // All the inequality operators (<, >, <=, >=, !=, ==) |
| 183 | func processBinaryBoolean(mNode *mathTree) error { |
| 184 | srcMap := mNode.Child[0].Val |
| 185 | destMap := types.NewShardedMap() |
| 186 | aggName := mNode.Fn |
| 187 | |
| 188 | ch := mNode.Child[1] |
| 189 | curMap := ch.Val |
| 190 | srcMap.Iterate(func(k uint64, val types.Val) error { |
| 191 | curVal, _ := curMap.Get(k) |
| 192 | if ch.Const.Value != nil { |
| 193 | // Use the constant value that was supplied. |
| 194 | curVal = ch.Const |
| 195 | } |
| 196 | res, err := compareValues(aggName, val, curVal) |
| 197 | if err != nil { |
| 198 | return errors.Wrapf(err, "Wrong values in comparison function.") |
| 199 | } |
| 200 | destMap.Set(k, types.Val{ |
| 201 | Tid: types.BoolID, |
| 202 | Value: res, |
| 203 | }) |
| 204 | return nil |
| 205 | }) |
| 206 | mNode.Val = destMap |
| 207 | return nil |
| 208 | } |
| 209 | |
| 210 | // processTernary handles the ternary operand cond() |
| 211 | func processTernary(mNode *mathTree) error { |