Fix some errors with the Map function

Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
davidarendsen 2023-01-12 12:11:28 +00:00
commit 0a4da04e58
2 changed files with 9 additions and 7 deletions

View file

@ -34,9 +34,9 @@ final class MapFunctionTest extends TestCase
$expression = new Map(MapExpression::columns([
'time' => 'r._time',
'source' => 'r.tag',
'alert' => SelectionExpression::if('r._value > 10')->then(true)->else(false),
'test' => SelectionExpression::if('r._value > 10')->then('yes')->else('no')
]));
'alert' => SelectionExpression::if('r._value > 10')->then(true)->else(false)->__toString(),
'test' => SelectionExpression::if('r._value > 10')->then('yes')->else('no')->__toString()
])->__toString());
$query = '|> map(fn: (r) => ({ {time: r._time, source: r.tag, ' .
'alert: if r._value > 10 then true else false, ' .