-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-46179][SQL] Add CrossDbmsQueryTestSuites, which runs other DBMS against golden files, starting with Postgres #44084
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
Closed
Closed
Changes from 12 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
612396c
Initial commit
andylam-db 83e6a51
Add CrossDbmsQueryTestSuite
andylam-db c691f83
Small changes for niceness
andylam-db 24a02f0
Save point
andylam-db 315847a
Add sqllogictest-select1.sql in postgres-crosstest input file
andylam-db 5e087e1
Add header for class suite
andylam-db 33b52b2
Small changes
andylam-db 81202c4
Trying to get the input files set up..
andylam-db c9fba5b
Passing test!!
andylam-db 8b5ed22
Ignore all earlier tests first
andylam-db fea3975
Small comment changes
andylam-db 678a0ef
More comments
andylam-db 309a7e2
Address simple comments
andylam-db 5c52b9c
A little more small changes..
andylam-db ad867df
More small changes and removal of redundant code
andylam-db bef8011
Generate golden files for SQLQueryTestSuite
andylam-db a6e7e2a
Revert "Generate golden files for SQLQueryTestSuite"
andylam-db 1409d63
Ignore "postgres-crosstest" in SQLQueryTestSuite
andylam-db a552d86
Add comment to clarify why it is ignored
andylam-db 7a9cb80
Fix compilation failures
andylam-db 66f41a5
Regenerate golden files for sqllogictest-select1.sql.out
andylam-db 69614d3
Tiny changes..
andylam-db 2bf43df
Add postgresql back to ignorelist
andylam-db aba83b8
Add exception handling in CrossDbmsQueryTestSuite
andylam-db bf4036d
Do refactoring so that we can add an additional input argument for Cr…
andylam-db 08e2cfb
Generate with postgres
andylam-db 2ec381c
Fix compilation error with ThriftServerQueryTestSuite
andylam-db 9c2d283
Generate golden files with SQLQueryTestSuite
andylam-db ab4ab12
Fixed a bug where tests weren't running against the golden file
andylam-db 0166aed
Use local spark session
andylam-db 2e45a67
Small comment change
andylam-db 496cd82
Merge master
andylam-db dd4597e
Revert change in ThriftServerQueryTestSuite
andylam-db cb71979
Remove DialectConverter..
andylam-db 6cd52f1
Don't run the tests if the cross dbms is not specified
andylam-db 7f39707
Remove sqllogictest
andylam-db 615f4d9
Small niceness changes
andylam-db cf345bd
Do null -> NULL replacement, and put 2 tests in
andylam-db cdef387
Add docker compose and bash scripts for easy postgres instance
andylam-db 36be209
Trivial changes
andylam-db d037331
Trivial changes
andylam-db 750a1de
Fix typo
andylam-db 089c292
Add header comments, and make CrossDbmsQuerySuite an abstract class
andylam-db 62d1760
Trivial changes
andylam-db def270b
Use prepared statements
andylam-db fdb90a4
Remove sql file changes for now
andylam-db 8c21ceb
Header comment improvements
andylam-db 50c2dfb
Trivial changes
andylam-db 939b8f2
Add custom postgres command
andylam-db db01061
Modify exists-having to be compatible with psql
andylam-db d8c7bc9
Merge branch 'master' into crossdbms
andylam-db 7200f7d
Modify query slightly
andylam-db 1d79345
Add readme and add ONLY_IF for most sql files in subquery dir
andylam-db 83cd8d4
Rewrite exists-having
andylam-db f491d1f
Update comment
andylam-db cc039ae
Merge master
andylam-db ce0e106
Ignore subquery-offset.sql
andylam-db 1d7c620
Create new file PostgreSQLQueryTestSuite.scala and fix indent
andylam-db 0e542cf
Move from postgres-results -> crossdbms-results
andylam-db 5d4c577
Fix silly paste
andylam-db 68ea6f2
Fix unintended removal of results file
andylam-db 1e1a283
In middle of refactoring..
andylam-db 5756c8e
Major refactoring in progress..
andylam-db 81a61f7
Passing tests
andylam-db cf7b044
Add documnetation and delete previous files
andylam-db a32a693
Move functions from PostgreSQLQueryTestSuite -> CrossDbmsQueryTestSuite
andylam-db e08f7a4
Merge master..
andylam-db 18f821f
Merge branch 'master' into crossdbms
andylam-db 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
90 changes: 90 additions & 0 deletions
90
sql/core/src/test/resources/sql-tests/inputs/postgres-crosstest/sqllogictest-select1.sql
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 |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| -- First 6 queries of the sql-logic-tests with some minor changes for compatibility, available here: | ||
| -- https://www.sqlite.org/sqllogictest/file?name=test/select1.test&ci=tip. | ||
|
|
||
| CREATE VIEW t1(a, b, c, d, e) AS VALUES | ||
| (103,102,100,101,104), | ||
| (107,106,108,109,105), | ||
| (110,114,112,111,113), | ||
| (116,119,117,115,118), | ||
| (123,122,124,120,121), | ||
| (127,128,129,126,125), | ||
| (132,134,131,133,130), | ||
| (138,136,139,135,137), | ||
| (144,141,140,142,143), | ||
| (145,149,146,148,147), | ||
| (151,150,153,154,152), | ||
| (155,157,159,156,158), | ||
| (161,160,163,164,162), | ||
| (167,169,168,165,166), | ||
| (171,170,172,173,174), | ||
| (177,176,179,178,175), | ||
| (181,180,182,183,184), | ||
| (187,188,186,189,185), | ||
| (190,194,193,192,191), | ||
| (199,197,198,196,195), | ||
| (200,202,203,201,204), | ||
| (208,209,205,206,207), | ||
| (214,210,213,212,211), | ||
| (218,215,216,217,219), | ||
| (223,221,222,220,224), | ||
| (226,227,228,229,225), | ||
| (234,231,232,230,233), | ||
| (237,236,239,235,238), | ||
| (242,244,240,243,241), | ||
| (246,248,247,249,245); | ||
|
|
||
| SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END | ||
| FROM t1 | ||
| ORDER BY 1; | ||
|
|
||
| SELECT a+b*2+c*3+d*4+e*5, | ||
| CAST((a+b+c+d+e)/5 AS INT) | ||
| FROM t1 | ||
| ORDER BY 1,2; | ||
|
|
||
| SELECT a+b*2+c*3+d*4+e*5, | ||
| CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222 | ||
| WHEN a<b+3 THEN 333 ELSE 444 END, | ||
| abs(b-c), | ||
| CAST((a+b+c+d+e)/5 AS INT), | ||
| a+b*2+c*3 | ||
| FROM t1 | ||
| WHERE (e>c OR e<d) | ||
| AND d>e | ||
| AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b) | ||
| ORDER BY 4,2,1,3,5; | ||
|
|
||
| SELECT c, | ||
| d-e, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| a+b*2+c*3+d*4, | ||
| e | ||
| FROM t1 | ||
| WHERE d NOT BETWEEN 110 AND 150 | ||
| OR c BETWEEN b-2 AND d+2 | ||
| OR (e>c OR e<d) | ||
| ORDER BY 1,5,3,2,4; | ||
|
|
||
| SELECT a+b*2+c*3+d*4, | ||
| CAST((a+b+c+d+e)/5 AS INT), | ||
| abs(a), | ||
| e, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| d | ||
| FROM t1 | ||
| WHERE b>c | ||
| AND c>d | ||
| ORDER BY 3,4,5,1,2,6; | ||
|
|
||
| SELECT a+b*2+c*3+d*4, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d), | ||
| c | ||
| FROM t1 | ||
| WHERE (c<=d-2 OR c>=d+2) | ||
| ORDER BY 4,2,1,3; | ||
|
|
||
| DROP VIEW IF EXISTS t1; | ||
236 changes: 236 additions & 0 deletions
236
...ources/sql-tests/results/postgres-results/postgres-crosstest/sqllogictest-select1.sql.out
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 |
|---|---|---|
| @@ -0,0 +1,236 @@ | ||
| -- Automatically generated by CrossDbmsQueryTestSuite | ||
| -- !query | ||
| CREATE VIEW t1(a, b, c, d, e) AS VALUES | ||
| (103,102,100,101,104), | ||
| (107,106,108,109,105), | ||
| (110,114,112,111,113), | ||
| (116,119,117,115,118), | ||
| (123,122,124,120,121), | ||
| (127,128,129,126,125), | ||
| (132,134,131,133,130), | ||
| (138,136,139,135,137), | ||
| (144,141,140,142,143), | ||
| (145,149,146,148,147), | ||
| (151,150,153,154,152), | ||
| (155,157,159,156,158), | ||
| (161,160,163,164,162), | ||
| (167,169,168,165,166), | ||
| (171,170,172,173,174), | ||
| (177,176,179,178,175), | ||
| (181,180,182,183,184), | ||
| (187,188,186,189,185), | ||
| (190,194,193,192,191), | ||
| (199,197,198,196,195), | ||
| (200,202,203,201,204), | ||
| (208,209,205,206,207), | ||
| (214,210,213,212,211), | ||
| (218,215,216,217,219), | ||
| (223,221,222,220,224), | ||
| (226,227,228,229,225), | ||
| (234,231,232,230,233), | ||
| (237,236,239,235,238), | ||
| (242,244,240,243,241), | ||
| (246,248,247,249,245) | ||
| -- !query output | ||
|
|
||
|
|
||
|
|
||
| -- !query | ||
| SELECT CASE WHEN c>(SELECT avg(c) FROM t1) THEN a*2 ELSE b*10 END | ||
| FROM t1 | ||
| ORDER BY 1 | ||
| -- !query output | ||
| 354 | ||
| 362 | ||
| 374 | ||
| 380 | ||
| 398 | ||
| 400 | ||
| 416 | ||
| 428 | ||
| 436 | ||
| 446 | ||
| 452 | ||
| 468 | ||
| 474 | ||
| 484 | ||
| 492 | ||
| 1020 | ||
| 1060 | ||
| 1140 | ||
| 1190 | ||
| 1220 | ||
| 1280 | ||
| 1340 | ||
| 1360 | ||
| 1410 | ||
| 1490 | ||
| 1500 | ||
| 1570 | ||
| 1600 | ||
| 1690 | ||
| 1700 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT a+b*2+c*3+d*4+e*5, | ||
| CAST((a+b+c+d+e)/5 AS INT) | ||
| FROM t1 | ||
| ORDER BY 1,2 | ||
| -- !query output | ||
| 1531 102 | ||
| 1604 107 | ||
| 1683 112 | ||
| 1755 117 | ||
| 1824 122 | ||
| 1899 127 | ||
| 1975 132 | ||
| 2052 137 | ||
| 2129 142 | ||
| 2208 147 | ||
| 2286 152 | ||
| 2360 157 | ||
| 2436 162 | ||
| 2499 167 | ||
| 2589 172 | ||
| 2653 177 | ||
| 2739 182 | ||
| 2802 187 | ||
| 2880 192 | ||
| 2946 197 | ||
| 3037 202 | ||
| 3100 207 | ||
| 3176 212 | ||
| 3259 217 | ||
| 3331 222 | ||
| 3405 227 | ||
| 3477 232 | ||
| 3556 237 | ||
| 3627 242 | ||
| 3704 247 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT a+b*2+c*3+d*4+e*5, | ||
| CASE WHEN a<b-3 THEN 111 WHEN a<=b THEN 222 | ||
| WHEN a<b+3 THEN 333 ELSE 444 END, | ||
| abs(b-c), | ||
| CAST((a+b+c+d+e)/5 AS INT), | ||
| a+b*2+c*3 | ||
| FROM t1 | ||
| WHERE (e>c OR e<d) | ||
| AND d>e | ||
| AND EXISTS(SELECT 1 FROM t1 AS x WHERE x.b<t1.b) | ||
| ORDER BY 4,2,1,3,5 | ||
| -- !query output | ||
| 1604 333 2 107 643 | ||
| 1899 222 1 127 770 | ||
| 1975 222 3 132 793 | ||
| 2208 111 3 147 881 | ||
| 2286 333 3 152 910 | ||
| 2436 333 3 162 970 | ||
| 2653 333 3 177 1066 | ||
| 2802 222 2 187 1121 | ||
| 2880 111 1 192 1157 | ||
| 2946 333 1 197 1187 | ||
| 3176 444 3 212 1273 | ||
| 3405 222 1 227 1364 | ||
| 3627 222 4 242 1450 | ||
| 3704 222 1 247 1483 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT c, | ||
| d-e, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| a+b*2+c*3+d*4, | ||
| e | ||
| FROM t1 | ||
| WHERE d NOT BETWEEN 110 AND 150 | ||
| OR c BETWEEN b-2 AND d+2 | ||
| OR (e>c OR e<d) | ||
| ORDER BY 1,5,3,2,4 | ||
| -- !query output | ||
| 100 -3 444 1011 104 | ||
| 108 4 222 1079 105 | ||
| 112 -2 333 1118 113 | ||
| 117 -3 222 1165 118 | ||
| 129 1 111 1274 125 | ||
| 131 3 333 1325 130 | ||
| 140 -1 555 1414 143 | ||
| 146 1 222 1473 147 | ||
| 153 2 444 1526 152 | ||
| 159 -2 333 1570 158 | ||
| 163 2 444 1626 162 | ||
| 168 -1 222 1669 166 | ||
| 172 -1 222 1719 174 | ||
| 179 3 333 1778 175 | ||
| 182 -1 222 1819 184 | ||
| 186 4 111 1877 185 | ||
| 193 1 444 1925 191 | ||
| 198 1 555 1971 195 | ||
| 203 -3 333 2017 204 | ||
| 205 -1 111 2065 207 | ||
| 213 1 555 2121 211 | ||
| 216 -2 444 2164 219 | ||
| 222 -4 444 2211 224 | ||
| 228 4 111 2280 225 | ||
| 232 -3 555 2312 233 | ||
| 239 -3 444 2366 238 | ||
| 240 2 333 2422 241 | ||
| 247 4 222 2479 245 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT a+b*2+c*3+d*4, | ||
| CAST((a+b+c+d+e)/5 AS INT), | ||
| abs(a), | ||
| e, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| d | ||
| FROM t1 | ||
| WHERE b>c | ||
| AND c>d | ||
| ORDER BY 3,4,5,1,2,6 | ||
| -- !query output | ||
| 1118 112 110 113 333 111 | ||
| 1165 117 116 118 222 115 | ||
| 1669 167 167 166 222 165 | ||
| 1925 192 190 191 444 192 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT a+b*2+c*3+d*4, | ||
| CASE a+1 WHEN b THEN 111 WHEN c THEN 222 | ||
| WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END, | ||
| (SELECT count(*) FROM t1 AS x WHERE x.c>t1.c AND x.d<t1.d), | ||
| c | ||
| FROM t1 | ||
| WHERE (c<=d-2 OR c>=d+2) | ||
| ORDER BY 4,2,1,3 | ||
| -- !query output | ||
| 1165 222 0 117 | ||
| 1219 222 0 124 | ||
| 1274 111 0 129 | ||
| 1325 333 0 131 | ||
| 1367 222 0 139 | ||
| 1414 555 0 140 | ||
| 1473 222 0 146 | ||
| 1570 333 0 159 | ||
| 1669 222 0 168 | ||
| 1877 111 0 186 | ||
| 1971 555 0 198 | ||
| 2017 333 0 203 | ||
| 2211 444 0 222 | ||
| 2312 555 0 232 | ||
| 2366 444 0 239 | ||
| 2422 333 0 240 | ||
| 2479 222 0 247 | ||
|
|
||
|
|
||
| -- !query | ||
| DROP VIEW IF EXISTS t1 | ||
| -- !query output | ||
|
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.