-
Notifications
You must be signed in to change notification settings - Fork 2k
minor: use sql to setup test data for aggregate.slt rather than rust #6664
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -15,6 +15,56 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| ####### | ||
| # Setup test data table | ||
| ####### | ||
| statement ok | ||
| CREATE EXTERNAL TABLE aggregate_test_100 ( | ||
| c1 VARCHAR NOT NULL, | ||
| c2 TINYINT NOT NULL, | ||
| c3 SMALLINT NOT NULL, | ||
| c4 SMALLINT, | ||
| c5 INT, | ||
| c6 BIGINT NOT NULL, | ||
| c7 SMALLINT NOT NULL, | ||
| c8 INT NOT NULL, | ||
| c9 INT UNSIGNED NOT NULL, | ||
| c10 BIGINT UNSIGNED NOT NULL, | ||
| c11 FLOAT NOT NULL, | ||
| c12 DOUBLE NOT NULL, | ||
| c13 VARCHAR NOT NULL | ||
| ) | ||
| STORED AS CSV | ||
| WITH HEADER ROW | ||
| LOCATION '../../testing/data/csv/aggregate_test_100.csv' | ||
|
|
||
| statement ok | ||
| CREATE TABLE d_table (c1 decimal(10,3)) as values | ||
| (110.000), (110.001), (110.002), (110.003), (110.004), (110.005), (110.006), (110.007), (110.008), (110.009), | ||
| (-100.000),(-100.001),(-100.002),(-100.003),(-100.004),(-100.005),(-100.006),(-100.007),(-100.008),(-100.009) | ||
|
|
||
| statement ok | ||
| CREATE TABLE median_table ( | ||
| col_i8 TINYINT, | ||
| col_i16 SMALLINT, | ||
| col_i32 INT, | ||
| col_i64 BIGINT, | ||
| col_u8 TINYINT UNSIGNED, | ||
| col_u16 SMALLINT UNSIGNED, | ||
| col_u32 INT UNSIGNED, | ||
| col_u64 BIGINT UNSIGNED, | ||
| col_f32 FLOAT, | ||
| col_f64 DOUBLE, | ||
| col_f64_nan DOUBLE | ||
| ) as VALUES | ||
| ( -128, -32768, -2147483648, arrow_cast(-9223372036854775808,'Int64'), 0, 0, 0, arrow_cast(0,'UInt64'), 1.1, 1.1, 1.1 ), | ||
| ( -128, -32768, -2147483648, arrow_cast(-9223372036854775808,'Int64'), 0, 0, 0, arrow_cast(0,'UInt64'), 4.4, 4.4, arrow_cast('NAN','Float64') ), | ||
| ( 100, 100, 100, arrow_cast(100,'Int64'), 100,100,100, arrow_cast(100,'UInt64'), 3.3, 3.3, arrow_cast('NAN','Float64') ), | ||
| ( 127, 32767, 2147483647, arrow_cast(9223372036854775807,'Int64'), 255, 65535, 4294967295, 18446744073709551615, 2.2, 2.2, arrow_cast('NAN','Float64') ) | ||
|
|
||
| statement ok | ||
| CREATE TABLE test (c1 BIGINT,c2 BIGINT) as values | ||
| (0,null), (1,1), (null,1), (3,2), (3,2) | ||
|
|
||
| ####### | ||
| # Error tests | ||
|
|
@@ -307,73 +357,73 @@ SELECT median(c12) FROM aggregate_test_100 | |
|
|
||
| # median_i8 | ||
| query I | ||
| SELECT median(a) FROM median_i8 | ||
| SELECT median(col_i8) FROM median_table | ||
| ---- | ||
| -14 | ||
|
|
||
| # median_i16 | ||
| query I | ||
| SELECT median(a) FROM median_i16 | ||
| SELECT median(col_i16) FROM median_table | ||
| ---- | ||
| -16334 | ||
|
|
||
| # median_i32 | ||
| query I | ||
| SELECT median(a) FROM median_i32 | ||
| SELECT median(col_i32) FROM median_table | ||
| ---- | ||
| -1073741774 | ||
|
|
||
| # median_i64 | ||
| query I | ||
| SELECT median(a) FROM median_i64 | ||
| SELECT median(col_i64) FROM median_table | ||
| ---- | ||
| -4611686018427387854 | ||
|
|
||
| # median_u8 | ||
| query I | ||
| SELECT median(a) FROM median_u8 | ||
| SELECT median(col_u8) FROM median_table | ||
| ---- | ||
| 50 | ||
|
|
||
| # median_u16 | ||
| query I | ||
| SELECT median(a) FROM median_u16 | ||
| SELECT median(col_u16) FROM median_table | ||
| ---- | ||
| 50 | ||
|
|
||
| # median_u32 | ||
| query I | ||
| SELECT median(a) FROM median_u32 | ||
| SELECT median(col_u32) FROM median_table | ||
| ---- | ||
| 50 | ||
|
|
||
| # median_u64 | ||
| query I | ||
| SELECT median(a) FROM median_u64 | ||
| SELECT median(col_u64) FROM median_table | ||
| ---- | ||
| 50 | ||
|
|
||
| # median_f32 | ||
| query R | ||
| SELECT median(a) FROM median_f32 | ||
| SELECT median(col_f32) FROM median_table | ||
| ---- | ||
| 3.3 | ||
| 2.75 | ||
|
|
||
| # median_f64 | ||
| query R | ||
| SELECT median(a) FROM median_f64 | ||
| SELECT median(col_f64) FROM median_table | ||
| ---- | ||
| 3.3 | ||
| 2.75 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change from |
||
|
|
||
| # median_f64_nan | ||
| query R | ||
| SELECT median(a) FROM median_f64_nan | ||
| SELECT median(col_f64_nan) FROM median_table | ||
| ---- | ||
| NaN | ||
|
|
||
| # approx_median_f64_nan | ||
| query R | ||
| SELECT approx_median(a) FROM median_f64_nan | ||
| SELECT approx_median(col_f64_nan) FROM median_table | ||
| ---- | ||
| NaN | ||
|
|
||
|
|
||
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.
Change
2.75to3.3Cause by testdata has been changed from
1.1, 4.4, 5.5, 3.3, 2.2to
1.1, 4.4, 3.3, 2.2It's makes it easier to create all the testdata in one table, because other testdata only have 4 column.
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.
I agree this makes sense -- thank you for the explanation.