mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-05 04:42:56 +00:00
81 lines
1.8 KiB
Plaintext
81 lines
1.8 KiB
Plaintext
-- Port from operators.test L607 - L630, commit 001ee2620e094970e5657ce39275b2fccdbd1359
|
|
-- Include atan2
|
|
-- load 5m
|
|
-- trigy{} 10
|
|
-- trigx{} 20
|
|
-- trigNaN{} NaN
|
|
create table trigy (ts timestamp(3) time index, val double);
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into trigy values (0,10);
|
|
|
|
Affected Rows: 1
|
|
|
|
create table trigx (ts timestamp(3) time index, val double);
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into trigx values (0,20);
|
|
|
|
Affected Rows: 1
|
|
|
|
create table trignan (ts timestamp(3) time index, val double);
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into trignan values (0, 'NaN'::double);
|
|
|
|
Affected Rows: 1
|
|
|
|
-- eval instant at 5m trigy atan2 trigx
|
|
-- trigy{} 0.4636476090008061
|
|
tql eval (300, 300, '1s') trigy atan2 trigx;
|
|
|
|
+---------------------+----------------------------+
|
|
| ts | atan2(trigy.val,trigx.val) |
|
|
+---------------------+----------------------------+
|
|
| 1970-01-01T00:05:00 | 0.4636476090008061 |
|
|
+---------------------+----------------------------+
|
|
|
|
-- eval instant at 5m trigy atan2 trigNaN
|
|
-- trigy{} NaN
|
|
-- This query doesn't have result because `trignan` is NaN and will be filtered out.
|
|
tql eval (300, 300, '1s') trigy atan2 trignan;
|
|
|
|
++
|
|
++
|
|
|
|
-- eval instant at 5m 10 atan2 20
|
|
-- 0.4636476090008061
|
|
tql eval (300, 300, '1s') 10 atan2 20;
|
|
|
|
+---------------------+--------------------+
|
|
| time | value |
|
|
+---------------------+--------------------+
|
|
| 1970-01-01T00:05:00 | 0.4636476090008061 |
|
|
+---------------------+--------------------+
|
|
|
|
-- eval instant at 5m 10 atan2 NaN
|
|
-- NaN
|
|
tql eval (300, 300, '1s') 10 atan2 NaN;
|
|
|
|
+---------------------+-------+
|
|
| time | value |
|
|
+---------------------+-------+
|
|
| 1970-01-01T00:05:00 | NaN |
|
|
+---------------------+-------+
|
|
|
|
drop table trigx;
|
|
|
|
Affected Rows: 0
|
|
|
|
drop table trigy;
|
|
|
|
Affected Rows: 0
|
|
|
|
drop table trignan;
|
|
|
|
Affected Rows: 0
|
|
|