So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT FLOOR(DATEDIFF(second, '1970-01-01', time)/60)*60 AS time, avg(value) as value FROM metric GROUP BY FLOOR(DATEDIFF(second, '1970-01-01', time)/60)*60 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT FLOOR(DATEDIFF(second, '1970-01-01', time)/60)*60 AS time, avg(value) as value FROM metric GROUP BY FLOOR(DATEDIFF(second, '1970-01-01', time)/60)*60 ORDER BY 1")
So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > '2018-03-15T12:55:00Z' OR time < '2018-03-15T12:55:00Z' OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > '2018-03-15T12:55:00Z' OR time < '2018-03-15T12:55:00Z' OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")
So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT UNIX_TIMESTAMP(time) DIV 60 * 60 AS time, avg(value) as value FROM metric GROUP BY 1 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT UNIX_TIMESTAMP(time) DIV 60 * 60 AS time, avg(value) as value FROM metric GROUP BY 1 ORDER BY 1")
So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > FROM_UNIXTIME(1521118500) OR time < FROM_UNIXTIME(1521118800) OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > FROM_UNIXTIME(1521118500) OR time < FROM_UNIXTIME(1521118800) OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")
So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT floor(extract(epoch from time)/60)*60 AS time, avg(value) as value FROM metric GROUP BY 1 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT floor(extract(epoch from time)/60)*60 AS time, avg(value) as value FROM metric GROUP BY 1 ORDER BY 1")
So(queryResult.Meta.Get("sql").MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > '2018-03-15T12:55:00Z' OR time < '2018-03-15T12:55:00Z' OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")
So(queryResult.Meta.Get(sqleng.MetaKeyExecutedQueryString).MustString(),ShouldEqual,"SELECT time FROM metric_values WHERE time > '2018-03-15T12:55:00Z' OR time < '2018-03-15T12:55:00Z' OR 1 < 1521118500 OR 1521118800 > 1 ORDER BY 1")