-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add sqlness tests for some promql function #1838
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ad3c492
correct range manipulate exec fmt text
waynexia 908617f
fix partition requirement
waynexia 7177af4
fix udf signature
waynexia e9d5d75
finilise
waynexia 5e4eee8
ignore unstable ordered result
waynexia f0a39c2
Merge branch 'dev' into tql-sqlness
waynexia fa0a032
add nan value test
waynexia 9383168
add comment
waynexia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
create table data (ts timestamp(3) time index, val double); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into data values | ||
(0, 'infinity'::double), | ||
(1, '-infinity'::double), | ||
(2, 'nan'::double), | ||
(3, 'NaN'::double); | ||
|
||
Affected Rows: 4 | ||
|
||
select * from data; | ||
|
||
+-------------------------+------+ | ||
| ts | val | | ||
+-------------------------+------+ | ||
| 1970-01-01T00:00:00 | inf | | ||
| 1970-01-01T00:00:00.001 | -inf | | ||
| 1970-01-01T00:00:00.002 | NaN | | ||
| 1970-01-01T00:00:00.003 | NaN | | ||
+-------------------------+------+ | ||
|
||
insert into data values (4, 'infinityyyy'::double); | ||
|
||
Error: 3001(EngineExecuteQuery), Cast error: Cannot cast string 'infinityyyy' to value of Float64 type | ||
|
||
drop table data; | ||
|
||
Affected Rows: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
create table data (ts timestamp(3) time index, val double); | ||
|
||
insert into data values | ||
(0, 'infinity'::double), | ||
(1, '-infinity'::double), | ||
(2, 'nan'::double), | ||
(3, 'NaN'::double); | ||
|
||
select * from data; | ||
|
||
insert into data values (4, 'infinityyyy'::double); | ||
|
||
drop table data; |
132 changes: 132 additions & 0 deletions
132
tests/cases/standalone/common/tql/aggr_over_time.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
create table metric (ts timestamp(3) time index, val double); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into metric values | ||
(0,0), | ||
(10000,8), | ||
(20000,8), | ||
(30000,2), | ||
(40000,3); | ||
|
||
Affected Rows: 5 | ||
|
||
select * from metric; | ||
|
||
+---------------------+-----+ | ||
| ts | val | | ||
+---------------------+-----+ | ||
| 1970-01-01T00:00:00 | 0.0 | | ||
| 1970-01-01T00:00:10 | 8.0 | | ||
| 1970-01-01T00:00:20 | 8.0 | | ||
| 1970-01-01T00:00:30 | 2.0 | | ||
| 1970-01-01T00:00:40 | 3.0 | | ||
+---------------------+-----+ | ||
|
||
tql eval (60, 61, '10s') stdvar_over_time(metric[1m]); | ||
|
||
+---------------------+-------------------------------------+ | ||
| ts | prom_stdvar_over_time(ts_range,val) | | ||
+---------------------+-------------------------------------+ | ||
| 1970-01-01T00:01:00 | 10.559999999999999 | | ||
+---------------------+-------------------------------------+ | ||
|
||
tql eval (60, 60, '1s') stddev_over_time(metric[1m]); | ||
|
||
+---------------------+-------------------------------------+ | ||
| ts | prom_stddev_over_time(ts_range,val) | | ||
+---------------------+-------------------------------------+ | ||
| 1970-01-01T00:01:00 | 3.249615361854384 | | ||
+---------------------+-------------------------------------+ | ||
|
||
tql eval (60, 60, '1s') stddev_over_time((metric[1m])); | ||
|
||
+---------------------+-------------------------------------+ | ||
| ts | prom_stddev_over_time(ts_range,val) | | ||
+---------------------+-------------------------------------+ | ||
| 1970-01-01T00:01:00 | 3.249615361854384 | | ||
+---------------------+-------------------------------------+ | ||
|
||
drop table metric; | ||
|
||
Affected Rows: 1 | ||
|
||
create table metric (ts timestamp(3) time index, val double); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into metric values | ||
(0,0), | ||
(10000,1.5990505637277868), | ||
(20000,1.5990505637277868), | ||
(30000,1.5990505637277868); | ||
|
||
Affected Rows: 4 | ||
|
||
tql eval (60, 60, '1s') stdvar_over_time(metric[1m]); | ||
|
||
+---------------------+-------------------------------------+ | ||
| ts | prom_stdvar_over_time(ts_range,val) | | ||
+---------------------+-------------------------------------+ | ||
| 1970-01-01T00:01:00 | 0.47943050725465364 | | ||
+---------------------+-------------------------------------+ | ||
|
||
tql eval (60, 60, '1s') stddev_over_time(metric[1m]); | ||
|
||
+---------------------+-------------------------------------+ | ||
| ts | prom_stddev_over_time(ts_range,val) | | ||
+---------------------+-------------------------------------+ | ||
| 1970-01-01T00:01:00 | 0.6924092050620454 | | ||
+---------------------+-------------------------------------+ | ||
|
||
drop table metric; | ||
|
||
Affected Rows: 1 | ||
|
||
create table data (ts timestamp(3) time index, val double, test string primary key); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into data values | ||
(0, 0, "two samples"), | ||
(10000, 1, "two samples"), | ||
(0, 0, "three samples"), | ||
(10000, 1, "three samples"), | ||
(20000, 2, "three samples"), | ||
(0, 0, "uneven samples"), | ||
(10000, 1, "uneven samples"), | ||
(20000, 4, "uneven samples"); | ||
|
||
Affected Rows: 8 | ||
|
||
drop table data; | ||
|
||
Affected Rows: 1 | ||
|
||
create table data (ts timestamp(3) time index, val double, ty string primary key); | ||
|
||
Affected Rows: 0 | ||
|
||
insert into data values | ||
(0, 2::double, 'numbers'), | ||
(10000, 0::double, 'numbers'), | ||
(20000, 3::double, 'numbers'), | ||
(0, 2::double, 'some_nan'), | ||
(10000, 0::double, 'some_nan'), | ||
(20000, 'NaN'::double, 'some_nan'), | ||
(0, 2::double, 'some_nan2'), | ||
(10000, 'NaN'::double, 'some_nan2'), | ||
(20000, 1::double, 'some_nan2'), | ||
(0, 'NaN'::double, 'some_nan3'), | ||
(10000, 0::double, 'some_nan3'), | ||
(20000, 1::double, 'some_nan3'), | ||
(0, 'NaN'::double, 'only_nan'), | ||
(10000, 'NaN'::double, 'only_nan'), | ||
(20000, 'NaN'::double, 'only_nan'); | ||
|
||
Affected Rows: 15 | ||
|
||
drop table data; | ||
|
||
Affected Rows: 1 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for improving it. Looks much better than
.get(0)
👍