diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/WindowTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/WindowTests.java index 2902d472540..5e32b59472d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/WindowTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/WindowTests.java @@ -159,7 +159,7 @@ public void testQ0() { PermutationTest test = q0.createTest(); List permutations = test.generateAll(); for (var t : permutations) { - this.qs(t, TestOptimizations.Optimized); + this.qst(t, TestOptimizations.Optimized); } } @@ -168,7 +168,7 @@ public void testQ1() { PermutationTest test = q1.createTest(); List permutations = test.generateAll(); for (var t : permutations) { - this.qs(t, TestOptimizations.Optimized); + this.qst(t, TestOptimizations.Optimized); } } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/functions/FunctionsTest.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/functions/FunctionsTest.java index 7f44b6b58b8..02e2f2fdee1 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/functions/FunctionsTest.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/functions/FunctionsTest.java @@ -35,25 +35,25 @@ public void testTypeError() { @Test public void testBround() { - this.qs(""" + this.qst(""" SELECT BROUND(1.123, 0), BROUND(1.123, 1), BROUND(1.123, 2), BROUND(1.123, 3); a | b | c | d ------------------------ 1 | 1.1 | 1.12 | 1.123 (1 row) - + SELECT BROUND(1.15, 1), BROUND(1.25, 1), BROUND(1.55, 1); a | b | c ----------------- 1.2 | 1.2 | 1.6 (1 row) - + SELECT BROUND(11.15, -1), BROUND(15.25, -1), BROUND(25.55, -1); a | b | c -------------- 10 | 20 | 30 (1 row) - + SELECT BROUND(11, -4), BROUND(11.25e0, 1), BROUND(0, CAST(1 AS TINYINT)); a | b | c ---------------- @@ -63,7 +63,7 @@ public void testBround() { @Test public void testBetween() { - this.qs(""" + this.qst(""" SELECT TIMESTAMP '2020-02-02 10:00:00' between TIMESTAMP '2020-02-02 09:00:00' and TIMESTAMP '2020-02-02 11:00:00'; result -------- @@ -126,7 +126,7 @@ public void testIssue1450() { @Test public void issue1520() { - this.qs(""" + this.qst(""" select 3.456::decimal(25, 3) + 1.123::decimal(4, 0); ?column? ---------- @@ -228,7 +228,7 @@ public void unicodeStringTests() { @Test public void testLeft() { - this.qs(""" + this.qst(""" SELECT LEFT('string', 1); result --------- @@ -246,13 +246,13 @@ public void testLeft() { --------- string (1 row) - + SELECT LEFT('string', -2); result --------- \s (1 row) - + SELECT LEFT('string', NULL); result --------- @@ -262,7 +262,7 @@ public void testLeft() { @Test public void testRight() { - this.qs(""" + this.qst(""" SELECT RIGHT('string', 1); result --------- @@ -280,13 +280,13 @@ public void testRight() { --------- string (1 row) - + SELECT RIGHT('string', -2); result --------- \s (1 row) - + SELECT RIGHT('string', NULL); result --------- @@ -296,13 +296,13 @@ public void testRight() { @Test public void testBinaryCast() { - this.qs(""" + this.qst(""" SELECT CAST('1234567890' AS VARBINARY) as val; val ----- 31323334353637383930 (1 row) - + SELECT '1234567890'::VARBINARY as val; val ----- @@ -328,7 +328,7 @@ public void issue1192() { // INT::MIN % -1 instead of just returning 0 @Test public void issue1187modulo() { - this.qs( + this.qst( """ SELECT (-128)::tinyint % (-1)::tinyint as x; x @@ -493,7 +493,7 @@ public void testLeftNull() { @Test public void testConcat() { - this.qs(""" + this.qst(""" SELECT CONCAT('string', 1); result --------- @@ -539,7 +539,7 @@ public void testCoalesce() { // Calcite rounds differently from Postgres and other databases @Test public void testRounding() { - this.qs(""" + this.qst(""" select CAST((CAST('1234.1264' AS DECIMAL(8, 4))) AS DECIMAL(6, 2)); cast ------ @@ -683,7 +683,7 @@ public void testDecimalErrors() { @Test public void testLn() { - this.qs(""" + this.qst(""" SELECT ROUND(ln(2e0), 12); ln ---- @@ -701,7 +701,7 @@ public void testLn() { @Test public void testIsInf() { - this.qs( + this.qst( """ SELECT IS_INF(null); is_inf @@ -770,7 +770,7 @@ public void testIsInf() { @Test public void testIsInfReal() { - this.qs(""" + this.qst(""" -- f64::MAX SELECT is_inf(1.7976931348623157e308::real); real @@ -790,7 +790,7 @@ public void testIsInfReal() { @Test public void testIsNan() { - this.qs(""" + this.qst(""" SELECT is_nan(null); is_nan -------- @@ -838,7 +838,7 @@ public void testIsNan() { @Test public void testPower() { - this.qs(""" + this.qst(""" SELECT power(2e0, 2); power ------- @@ -904,7 +904,7 @@ public void testPower() { @Test public void testSqrtDouble() { - this.qs(""" + this.qst(""" SELECT sqrt(9e0); sqrt ------ @@ -928,7 +928,7 @@ public void testRoundDecimalDecimal() { @Test public void testRound() { - this.qs(""" + this.qst(""" select round(15.1); round(15.1) ------------ @@ -1450,7 +1450,7 @@ public void testRound() { @Test public void testTruncate() { - this.qs(""" + this.qst(""" select truncate(5678.123451); truncate(5678.123451) ----- @@ -1746,7 +1746,7 @@ public void testTruncate() { @Test public void testRoundTruncateEdgeCases() { // Calcite normalizes the sign here - this.qs(""" + this.qst(""" select truncate(-0.00123::DOUBLE, 2); truncate ---------- @@ -1794,7 +1794,7 @@ public void testRoundBigInt() { @Test public void testExp() { - this.qs(""" + this.qst(""" SELECT EXP(0.0); exp ----- @@ -1830,7 +1830,7 @@ public void testExp() { @Test public void testExpEdgeCase() { - this.qs(""" + this.qst(""" -- changed the type from numeric to double -- therefore the value has also slightly changed -- cases that used to generate inaccurate results in Postgres @@ -1845,7 +1845,7 @@ public void testExpEdgeCase() { @Test public void testGunzip() { - this.qs(""" + this.qst(""" SELECT GUNZIP(x'1f8b08000000000000ff4b4bcd49492d4a0400218115ac07000000'::bytea); gunzip ------------ @@ -1881,13 +1881,13 @@ public void testGunzip() { @Test public void testNulls() { - this.qs(""" + this.qst(""" SELECT sign(null); sign ------------ null (1 row) - + SELECT st_distance(null, st_point(0,0)); sign ------------ @@ -1898,7 +1898,7 @@ public void testNulls() { @Test public void testMD5() { - this.qs(""" + this.qst(""" SELECT MD5(x'0123456789ABCDEF'); md5 ------------ @@ -1934,7 +1934,7 @@ public void testGunzipRuntimeFail() { @Test public void testIssue1505() { - this.qs(""" + this.qst(""" SELECT ROUND(123.1234::DOUBLE, 2); round ------- @@ -1964,7 +1964,7 @@ public void testIssue1505() { @Test public void testRlike() { - this.qs(""" + this.qst(""" SELECT RLIKE('string', 's..i.*'); rlike ------- @@ -2004,7 +2004,7 @@ public void testRlike() { @Test public void testSequence() { - this.qs(""" + this.qst(""" SELECT SEQUENCE(1, 10); sequence ---------- @@ -2088,7 +2088,7 @@ public void testSequence() { @Test public void testCeilInt() { - this.qs(""" + this.qst(""" SELECT ceil(2::tinyint); ceil ------ @@ -2148,7 +2148,7 @@ public void testCeilInt() { @Test public void testFloorInt() { - this.qs(""" + this.qst(""" SELECT floor(2::tinyint); floor ------ @@ -2208,44 +2208,44 @@ public void testFloorInt() { @Test public void testBlackboxFunction() { - this.qs(""" + this.qst(""" SELECT blackbox(1); blackbox ---------- 1 (1 row) - + SELECT blackbox('blah'); blackbox ---------- blah (1 row) - + SELECT blackbox(true); blackbox ---------- true (1 row) - + SELECT blackbox(1e0); blackbox ---------- 1e0 (1 row) - + SELECT blackbox(1.0); blackbox ---------- 1.0 (1 row) - + SELECT blackbox(vals) from arr_table; blackbox ---------- {1,2,3} {1,2,3} (2 rows) - + SELECT blackbox(1.0) as c0, blackbox(true) as c1; c0 | c1 -----+----- @@ -2257,25 +2257,25 @@ public void testBlackboxFunction() { @Test public void testInitcapSpaces() { - this.qs(""" + this.qst(""" SELECT INITCAP_SPACES('hi man'); r --- Hi Man (1 row) - + SELECT INITCAP_SPACES('hi THOMAS-SON'); r --- Hi Thomas-son (1 row) - + SELECT INITCAP_SPACES(NULL); r --- NULL (1 row) - + SELECT INITCAP('ggj12341jhg12341=-012341asdf'); r --- @@ -2287,7 +2287,7 @@ public void testInitcapSpaces() { public void issue4559() { var ccs = this.getCCS(""" CREATE TABLE str_tbl(id INT, str VARCHAR); - + CREATE MATERIALIZED VIEW trim_legal AS SELECT TRIM(trailing 'い' from str) FROM str_tbl;"""); diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/DateFormatsTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/DateFormatsTests.java index 63faa11842c..22f2cd957cc 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/DateFormatsTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/DateFormatsTests.java @@ -38,7 +38,7 @@ public void testFormat() { @Test public void testParseDate() { - this.qs(""" + this.qst(""" SELECT PARSE_DATE(' %Y-%m-%d', ' 2020-10-01'); d --- @@ -110,7 +110,7 @@ public void testFormat2() { public void testCorners() { // Year 0 is not legal, replaced with year 1 // %Y in MySql is %y - this.qs(""" + this.qst(""" SELECT format_date('%Y-%m', DATE '2020-10-10'); valid_date ------------ diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/TimestampDiffTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/TimestampDiffTests.java index 130fb272ab7..6423ba0a4ef 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/TimestampDiffTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/TimestampDiffTests.java @@ -25,7 +25,7 @@ public void issue4651() { @Test public void issue4610() { - this.qs(""" + this.qst(""" SELECT CAST(TIME '10:00:00' AS TIMESTAMP); t --- @@ -49,7 +49,7 @@ public void issue4610() { // https://github.com/mysql/mysql-server/blob/mysql-test/r/func_time.result#L715 @Test public void testTimestampDiff0() { - this.qs(""" + this.qst(""" select timestampdiff(MONTH, DATE '2001-02-01', DATE '2001-05-01') as a; a ----- @@ -102,7 +102,7 @@ public void testTimestampDiff0() { @Test public void testDateDiff() { // same as testTimestampDiff0 above, but using DATEDIFF as a function - this.qs(""" + this.qst(""" select datediff(MONTH, DATE '2001-02-01', DATE '2001-05-01') as a; a ----- @@ -155,7 +155,7 @@ public void testDateDiff() { @Test public void testDateAdd() { // This is manually written and validated using MySQL - this.qs(""" + this.qst(""" select timestampadd(MONTH, 3, DATE '2001-02-01') as a; a ----- @@ -207,7 +207,7 @@ public void testDateAdd() { @Test public void testDateDayDiff() { - this.qs(""" + this.qst(""" select timestampdiff(SQL_TSI_DAY, DATE '1986-02-01', DATE '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, DATE '1900-02-01', DATE '1900-03-01') as a2, timestampdiff(SQL_TSI_DAY, DATE '1996-02-01', DATE '1996-03-01') as a3, @@ -220,7 +220,7 @@ select timestampdiff(SQL_TSI_DAY, DATE '1986-02-01', DATE '1986-03-01') as a1, @Test public void testTimestampDiff() { - this.qs(""" + this.qst(""" select timestampdiff(SQL_TSI_MINUTE, TIMESTAMP '2001-02-01 12:59:59', TIMESTAMP '2001-05-01 12:58:59') as a; a ----- @@ -380,7 +380,7 @@ public void testTimestampDiff() { @Test public void testMonthDiff() { - this.qs(""" + this.qst(""" select timestampdiff(month, DATE '2004-09-11', DATE '2004-09-11'); timestampdiff(month, DATE '2004-09-11', DATE '2004-09-11') ----- @@ -487,7 +487,7 @@ public void testMonthDiff() { @Test public void diffTests() { - this.qs(""" + this.qst(""" select (DATE '2024-01-01' - DATE '2023-12-31') DAYS; days ------ @@ -509,7 +509,7 @@ public void diffTests() { @Test public void diffTests2() { - this.qs(""" + this.qst(""" select TIMESTAMPDIFF(DAY, DATE '2024-01-01', DATE '2023-12-31'); days ------ @@ -532,7 +532,7 @@ public void diffTests2() { @Test public void issue5986() { - this.qs(""" + this.qst(""" SELECT CONVERT_TIMEZONE('America/New_York', 'America/Los_Angeles', TIMESTAMP '2008-03-05 12:25:29'); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/VarbinaryTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/VarbinaryTests.java index 8c46606e3e5..251a65d817a 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/VarbinaryTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/mysql/VarbinaryTests.java @@ -116,7 +116,7 @@ public void testToInt() { @Test public void testConcatBinary() { - this.qs(""" + this.qst(""" SELECT x'0a' || x'bc'; result ------ @@ -145,7 +145,7 @@ public void testConcatBinary() { // While Postgres doesn't allow negative "overlay from" value, we treat it as 0 @Test public void testOverlay() { - this.qs(""" + this.qst(""" SELECT overlay(x'1234567890'::bytea placing x'0203' from 2 for 3); overlay --------- @@ -186,7 +186,7 @@ public void testOverlay() { @Test public void testIntToBinaryCasts() { - this.qs(""" + this.qst(""" SELECT CAST(10 AS BINARY(4)); r --- @@ -256,7 +256,7 @@ public void testIntToBinaryCasts() { @Test public void testCast() { - this.qs(""" + this.qst(""" SELECT CAST('abcd1234' AS VARBINARY); r --- @@ -278,7 +278,7 @@ public void testCast() { @Test public void testLeftAndRight() { - this.qs(""" + this.qst(""" SELECT right(x'ABCdef', 1); result ------- @@ -349,7 +349,7 @@ public void testLeftAndRight() { // Tested on Postgres @Test public void testSubstring() { - this.qs(""" + this.qst(""" SELECT substring(x'123456', 0); substring ----------- @@ -389,7 +389,7 @@ public void testSubstring() { @Test public void testSubstringFail() { - this.qs(""" + this.qst(""" SELECT substring(x'123456', 3, -1); result ------ @@ -399,7 +399,7 @@ public void testSubstringFail() { @Test public void testOctetLength() { - this.qs(""" + this.qst(""" SELECT octet_length(x'123456'::bytea); length -------- @@ -429,7 +429,7 @@ public void testOctetLength() { @Test public void testPosition() { - this.qs(""" + this.qst(""" SELECT position(x'20' IN x'102023'::bytea); position ---------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresAggregatesTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresAggregatesTests.java index 9548a18267e..0a6737ad704 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresAggregatesTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresAggregatesTests.java @@ -34,7 +34,7 @@ CREATE TABLE bool_test( @Test public void testBitAggs() { - this.qs(""" + this.qst(""" -- empty case SELECT BIT_AND(i2), @@ -43,7 +43,7 @@ public void testBitAggs() { FROM (SELECT * FROM bitwise_test WHERE FALSE); a | o | x ---+---+--- - | | \s + | | (1 row) SELECT @@ -74,7 +74,7 @@ public void testBitAggs() { @Test public void testBoolAgg() { - this.qs(""" + this.qst(""" -- empty case SELECT BOOL_AND(b1) AS "n0", diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresArrayTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresArrayTests.java index 8d01e4b1511..9823ce08f0c 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresArrayTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresArrayTests.java @@ -9,7 +9,7 @@ public class PostgresArrayTests extends SqlIoTest { @Test public void testSplit() { // Renamed 'string_to_array' to 'split' - this.qs(""" + this.qst(""" select split('1|2|3', '|'); split ----------------- @@ -82,7 +82,7 @@ public void testSplit() { @Test public void testArrayToString() { // In Calcite array_to_string requires all arguments to be strings - this.qs(""" + this.qst(""" select array_to_string(NULL::TEXT ARRAY, ',') IS NULL; ?column? ---------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresBoolTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresBoolTests.java index 083b0f19587..54290b769b4 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresBoolTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresBoolTests.java @@ -82,7 +82,7 @@ public void testFalse() { @Test public void testIs() { - this.q(""" + this.qst(""" SELECT d, b IS TRUE AS istrue, @@ -94,15 +94,16 @@ public void testIs() { FROM booltbl3; d | istrue | isnottrue | isfalse | isnotfalse | isunknown | isnotunknown -------+--------+-----------+---------+------------+-----------+-------------- - true| t | f | f | t | f | t - false| f | t | t | f | f | t - null| f | t | f | t | t | f"""); + true | t | f | f | t | f | t + false | f | t | t | f | f | t + null | f | t | f | t | t | f + (3 rows)"""); } @Test public void testShortcut() { // This is not from Postgres - this.q(""" + this.qst(""" SELECT v0, v1, v0 OR v1 FROM (SELECT b AS v0 FROM BOOLTBL3) CROSS JOIN (SELECT b as v1 FROM BOOLTBL3); v0 | v1 | v0 OR v1 -------------------- @@ -114,8 +115,9 @@ public void testShortcut() { null| f |null t |null| t f |null|null - null|null|null"""); - this.q(""" + null|null|null + (9 rows) + SELECT v0, v1, v0 AND v1 FROM (SELECT b AS v0 FROM BOOLTBL3) CROSS JOIN (SELECT b as v1 FROM BOOLTBL3); v0 | v1 | v0 AND v1 -------------------- @@ -127,19 +129,21 @@ public void testShortcut() { null| f | f t |null|null f |null| f - null|null|null"""); - this.q(""" + null|null|null + (9 rows) + SELECT v0, NOT v0 FROM (SELECT b AS v0 FROM BOOLTBL3); v0 | NOT v0 --------------- t | f f | t - null|null"""); + null|null + (3 rows)"""); } @Test public void testBool() { - this.qs(""" + this.qst(""" SELECT istrue AND isnul AND istrue FROM booltbl4; ?column? ---------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCaseTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCaseTests.java index ae00a4b4f1d..04cb44d0e4c 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCaseTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCaseTests.java @@ -32,14 +32,14 @@ CREATE TABLE CASE2_TBL ( @Test public void testCase() { - this.qs(""" + this.qst(""" SELECT '3' AS "One", CASE WHEN 1 < 2 THEN 3 END AS "Simple WHEN"; One | Simple WHEN -----+------------- - 3| 3 + 3 | 3 (1 row) SELECT '' AS "One", @@ -48,7 +48,7 @@ public void testCase() { END AS "Simple default"; One | Simple default --------+---------------- - | \s + | (1 row) SELECT '3' AS "One", @@ -58,7 +58,7 @@ public void testCase() { END AS "Simple ELSE"; One | Simple ELSE -----+------------- - 3| 3 + 3 | 3 (1 row) SELECT '4' AS "One", @@ -68,7 +68,7 @@ public void testCase() { END AS "ELSE default"; One | ELSE default -----+-------------- - 4| 4 + 4 | 4 (1 row) SELECT '6' AS "One", @@ -79,7 +79,7 @@ public void testCase() { END AS "Two WHEN with default"; One | Two WHEN with default -----+----------------------- - 6| 6 + 6 | 6 (1 row) SELECT '7' AS "None", @@ -87,7 +87,7 @@ public void testCase() { END AS "NULL on no matches"; None | NULL on no matches ------+-------------------- - 7| \s + 7 | (1 row) -- Constant-expression folding shouldn't evaluate unreachable subexpressions @@ -107,7 +107,7 @@ public void testCase() { @Test public void testCases2() { // changed error to null output - this.qs(""" + this.qst(""" SELECT CASE WHEN i > 100 THEN 1/0 ELSE 0 END FROM case_tbl; case ------ diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCollateTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCollateTests.java index c2f70adefab..b4bc937200f 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCollateTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresCollateTests.java @@ -23,11 +23,12 @@ CREATE TABLE collate_test10 ( @Test public void testUpperLower() { - this.q(""" + this.qst(""" SELECT a, lower(x), lower(y), upper(x), upper(y), initcap(x), initcap(y) FROM collate_test10; a | lower | lower | upper | upper | initcap | initcap ---+-------+-------+-------+-------+---------+--------- - 1 | hij| hij| HIJ| HIJ| Hij| Hij - 2 | hij| hij| HIJ| HIJ| Hij| Hij"""); + 1 | hij | hij | HIJ | HIJ | Hij | Hij + 2 | hij | hij | HIJ | HIJ | Hij | Hij + (2 rows)"""); } } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresDateTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresDateTests.java index 98c0c28782b..db8870bf81d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresDateTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresDateTests.java @@ -244,101 +244,68 @@ public void testExtract() { } @Test - public void testEpoch() { - this.q(""" + public void testExtract1() { + this.qst(""" SELECT EXTRACT(EPOCH FROM DATE '1970-01-01'); extract --------- - 0"""); - } + 0 + (1 row) - @Test - public void testCentury() { - this.q(""" SELECT EXTRACT(CENTURY FROM DATE '0001-01-01'); extract --------- - 1"""); - } - - @Test - public void testCentury1() { - this.q(""" + 1 + (1 row) + SELECT EXTRACT(CENTURY FROM DATE '1900-12-31'); extract --------- - 19"""); - } - - @Test - public void testCentury2() { - this.q(""" + 19 + (1 row) + SELECT EXTRACT(CENTURY FROM DATE '1901-01-01'); extract --------- - 20"""); - } + 20 + (1 row) - @Test - public void testCentury3() { - this.q(""" SELECT EXTRACT(CENTURY FROM DATE '2000-12-31'); extract --------- - 20"""); - } + 20 + (1 row) - @Test - public void testCentury4() { - this.q(""" SELECT EXTRACT(CENTURY FROM DATE '2001-01-01'); extract --------- - 21"""); - } - - @Test - public void testMillennium() { - this.q(""" + 21 + (1 row) + SELECT EXTRACT(MILLENNIUM FROM DATE '0001-01-01'); extract --------- - 1"""); - } + 1 + (1 row) - @Test - public void testMillennium1() { - this.q(""" SELECT EXTRACT(MILLENNIUM FROM DATE '1000-12-31'); extract --------- - 1"""); - } + 1 + (1 row) - @Test - public void testMillennium2() { - this.q(""" SELECT EXTRACT(MILLENNIUM FROM DATE '2000-12-31'); extract --------- - 2"""); - } - - // CURRENT_DATE not supported - // SELECT EXTRACT(CENTURY FROM CURRENT_DATE)>=21 AS True; -- true - - @Test - public void testMillennium3() { - this.q(""" + 2 + (1 row) + SELECT EXTRACT(MILLENNIUM FROM DATE '2001-01-01'); extract --------- - 3"""); - } + 3 + (1 row) - @Test - public void testDecade() { - this.qs(""" SELECT EXTRACT(DECADE FROM DATE '1994-12-25'); extract --------- @@ -355,205 +322,139 @@ public void testDecade() { extract --------- 0 - (1 row)"""); - } - - @Test - public void testMicroseconds() { - this.q(""" + (1 row) + SELECT EXTRACT(MICROSECOND FROM DATE '2020-08-11'); extract --------- - 0"""); - } + 0 + (1 row) - @Test - public void testMilliseconds() { - this.q(""" SELECT EXTRACT(MILLISECOND FROM DATE '2020-08-11'); extract --------- - 0"""); - } - - @Test - public void testSeconds() { - this.q(""" + 0 + (1 row) + SELECT EXTRACT(SECOND FROM DATE '2020-08-11'); extract --------- - 0"""); - } + 0 + (1 row) - @Test - public void testSeconds0() { - this.q(""" SELECT SECOND(DATE '2020-08-11'); extract --------- - 0"""); - } - - @Test - public void testMinutes() { - this.q(""" + 0 + (1 row) + SELECT EXTRACT(MINUTE FROM DATE '2020-08-11'); extract --------- - 0"""); - } - - @Test - public void testMinutes1() { - this.q(""" + 0 + (1 row) + SELECT MINUTE(DATE '2020-08-11'); extract --------- - 0"""); - } - - @Test - public void testHour() { - this.q(""" + 0 + (1 row) + SELECT EXTRACT(HOUR FROM DATE '2020-08-11'); extract --------- - 0"""); - } - - @Test - public void testHour1() { - this.q(""" + 0 + (1 row) + SELECT HOUR(DATE '2020-08-11'); extract --------- - 0"""); - } + 0 + (1 row) - @Test - public void testDay() { - this.q(""" SELECT EXTRACT(DAY FROM DATE '2020-08-11'); extract --------- - 11"""); - } + 11 + (1 row) - @Test - public void testDay1() { - this.q(""" SELECT DAYOFMONTH(DATE '2020-08-11'); extract --------- - 11"""); - } + 11 + (1 row) - @Test - public void testMonth() { - this.q(""" SELECT EXTRACT(MONTH FROM DATE '2020-08-11'); extract --------- - 8"""); - } + 8 + (1 row) - @Test - public void testMonth1() { - this.q(""" SELECT MONTH(DATE '2020-08-11'); extract --------- - 8"""); - } - - @Test - public void testYear() { - this.q(""" + 8 + (1 row) + SELECT EXTRACT(YEAR FROM DATE '2020-08-11'); extract --------- - 2020"""); - } + 2020 + (1 row) - @Test - public void testYear1() { - this.q(""" SELECT YEAR(DATE '2020-08-11'); extract --------- - 2020"""); - } + 2020 + (1 row) - @Test - public void testDecade5() { - this.q(""" SELECT EXTRACT(DECADE FROM DATE '2020-08-11'); extract --------- - 202"""); - } + 202 + (1 row) - @Test - public void testCentury5() { - this.q(""" SELECT EXTRACT(CENTURY FROM DATE '2020-08-11'); extract --------- - 21"""); - } - - @Test - public void testMillennium5() { - this.q(""" + 21 + (1 row) + SELECT EXTRACT(MILLENNIUM FROM DATE '2020-08-11'); extract --------- - 3"""); - } - - @Test - public void testIsoYear() { - this.q(""" + 3 + (1 row) + SELECT EXTRACT(ISOYEAR FROM DATE '2020-08-11'); extract --------- - 2020"""); - } - - @Test - public void testQuarter() { - this.q(""" + 2020 + (1 row) + SELECT EXTRACT(QUARTER FROM DATE '2020-08-11'); extract --------- - 3"""); - } - - @Test - public void testWeek() { - this.q(""" + 3 + (1 row) + SELECT EXTRACT(WEEK FROM DATE '2020-08-11'); extract --------- - 33"""); - } + 33 + (1 row) - @Test - public void testDow() { - this.q(""" SELECT EXTRACT(DOW FROM DATE '2020-08-11'); extract --------- - 3"""); - } + 3 + (1 row) - @Test - public void testDow2() { - this.q(""" SELECT DAYOFWEEK(DATE '2020-08-11'); extract --------- - 3"""); + 3 + (1 row)"""); } /* @@ -599,7 +500,7 @@ public void testDoy() { public void testDateTrunc() { // In the BigQuery library there is a DATE_TRUNC, but arguments are swapped // I added many more tests - this.qs(""" + this.qst(""" SELECT DATE_TRUNC(DATE '1970-03-20', MILLENNIUM); date_trunc -------------------------- @@ -693,7 +594,7 @@ public void testDateTrunc() { @Test public void testLimitTimestamps() { - this.qs(""" + this.qst(""" SELECT TIMESTAMP '9999-12-12 23:59:59', TIMESTAMP '0001-01-01 00:00:00'; ts0 | ts1 ----------- @@ -704,7 +605,7 @@ public void testLimitTimestamps() { @Test public void testTimeststampTrunc() { // Not in Postgres - this.qs(""" + this.qst(""" SELECT timestamp_trunc(TIMESTAMP '1970-03-20 04:30:00.00000', MILLENNIUM); timestamp_trunc -------------------------- @@ -763,7 +664,7 @@ public void testTimeststampTrunc() { @Test public void testTimeTrunc() { // Not in Postgres - this.qs(""" + this.qst(""" SELECT time_trunc(time '12:34:56.78', hour); trunc -------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat4Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat4Tests.java index 8da1edd8579..52d2254a804 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat4Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat4Tests.java @@ -149,7 +149,7 @@ public void testFPTable() { @Test public void testComp() { - this.qs(""" + this.qst(""" SELECT f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3'; f1 --------------- @@ -203,7 +203,7 @@ public void testComp() { @Test public void testFPArithmetic() { // Skipped the unary 'abs' Postgres operator written as '@' - this.qs("SELECT f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f\n" + + this.qst("SELECT f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f\n" + " WHERE f.f1 > '0.0';\n" + " f1 | x \n" + "---------------+----------------\n" + diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Part2Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Part2Tests.java index 3818367b9fd..405b44dfb9a 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Part2Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Part2Tests.java @@ -24,7 +24,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void testSelect() { - this.qs(""" + this.qst(""" SELECT * FROM FLOAT8_TBL; f1 ----------------------- @@ -46,7 +46,7 @@ public void testSelect() { @Test public void testsThatFailInPostgres() { - this.qs(""" + this.qst(""" -- this fails in Postgres with overflow but we return -inf SELECT f.f1 * '1e200' from FLOAT8_TBL f; f1 @@ -95,7 +95,7 @@ public void testsThatFailInPostgres() { // https://github.com/feldera/feldera/issues/1363 @Test public void testLn() { - this.qs(""" + this.qst(""" -- postgres doesn't allow ln(0) SELECT log10(f.f1) from FLOAT8_TBL f where f.f1 = '0.0'; f1 diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Tests.java index 798edd20d73..b088e6e5e23 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresFloat8Tests.java @@ -31,7 +31,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void testSelect() { - this.qs(""" + this.qst(""" -- special inputs SELECT 'NaN'::float8; float8 @@ -843,7 +843,7 @@ SELECT power(f.f1, '2.0'::DOUBLE) AS square_f1 // Postgres gives a runtime error, but rust returns inf @Test public void testPower2() { - this.qs(""" + this.qst(""" SELECT power('0'::DOUBLE, '-inf'::DOUBLE); power ------- @@ -874,7 +874,7 @@ public void castToInt() { @Test public void nonPostgresTests() { - this.qs(""" + this.qst(""" SELECT ln(1); ln ---- @@ -1092,7 +1092,7 @@ WITH v(x) AS (VALUES(0E0),(1E0),(-1E0),(4.2E0),(CAST ('Infinity' AS DOUBLE)),(CA @Test public void testModulo() { - this.qs(""" + this.qst(""" select 1.12::DOUBLE % 0.3::DOUBLE; ?column? ---------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresGroupingSetsTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresGroupingSetsTests.java index 01647cb30b6..0c75e3bed39 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresGroupingSetsTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresGroupingSetsTests.java @@ -17,7 +17,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void testRollup() { // commented out order by - this.qs(""" + this.qst(""" select a, b, grouping(a,b), sum(v), count(*), max(v) from gstest1 group by rollup (a,b); a | b | grouping | sum | count | max diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt2Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt2Tests.java index 4f3628a5011..8217d5c76f9 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt2Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt2Tests.java @@ -23,7 +23,7 @@ INSERT INTO INT2_TBL(f1) VALUES @Test public void testSelect() { - this.qs( + this.qst( """ SELECT * FROM INT2_TBL; f1 diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt4Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt4Tests.java index a2decf4ba6c..5e71382e850 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt4Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt4Tests.java @@ -23,7 +23,7 @@ INSERT INTO INT4_TBL(f1) VALUES @Test public void testSelect() { - this.qs( + this.qst( """ SELECT i.* FROM INT4_TBL i WHERE i.f1 <> '0'::INT2; f1 diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt8Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt8Tests.java index cd8452eb8d5..680a36f2daa 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt8Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresInt8Tests.java @@ -24,7 +24,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void precisionLossTest() { - this.qs(""" + this.qst(""" SELECT CAST('36854775807.0'::float4 AS int64); int8 ------------- @@ -34,7 +34,7 @@ public void precisionLossTest() { @Test public void testSelect() { - this.qs( + this.qst( """ SELECT * FROM INT8_TBL; q1 | q2 diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresIntervalTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresIntervalTests.java index b04a218dca5..d22cc560c9d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresIntervalTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresIntervalTests.java @@ -40,7 +40,7 @@ public void testInterval() { // Had to add the symbolic intervals by hand in many places // Postgres allows individual signs on fragments, the // standard doesn't - this.qs(""" + this.qst(""" SELECT INTERVAL '01:00' HOUR TO MINUTE AS "One hour"; One hour ---------- @@ -94,7 +94,7 @@ public void testInterval() { @Test public void testIntervalOperators() { - this.qs(""" + this.qst(""" SELECT * FROM SHORT_INTERVAL_TBL; i --- @@ -174,7 +174,7 @@ public void testIntervalOperators() { @Test public void testIntervalOperations() { - this.qs(""" + this.qst(""" SELECT r1.*, r2.* FROM SHORT_INTERVAL_TBL r1, SHORT_INTERVAL_TBL r2 WHERE r1.i > r2.i; @@ -227,7 +227,7 @@ public void testLimits() { @Test public void testLimitsPositive() { // Our limits are smaller than postgres, so this has been adapted - this.qs(""" + this.qst(""" SELECT -(INTERVAL -2147483 months); ?column? ------------------------ @@ -249,7 +249,7 @@ public void testLimitsPositive() { @Test public void testIntervalSub() { - this.qs(""" + this.qst(""" SELECT i - i FROM SHORT_INTERVAL_TBL; ?column? ---------- @@ -271,7 +271,7 @@ public void testOverflows() { @Test public void literals() { - this.qs(""" + this.qst(""" SELECT interval '999' second; -- oversize leading field is ok interval ---------- @@ -398,7 +398,7 @@ public void literals() { @Test public void testCast() { // Have to check the spec for the expected result - this.qs(""" + this.qst(""" SELECT CAST(i AS INTERVAL YEAR) FROM LONG_INTERVAL_TBL; i --- @@ -413,7 +413,7 @@ public void testCast() { @Test public void checkExtract() { // I think our definition of EXTRACT(EPOCH) is saner than Postgres - this.qs(""" + this.qst(""" SELECT i, EXTRACT(MICROSECOND FROM i) AS MICROSECOND, EXTRACT(MILLISECOND FROM i) AS MILLISECOND, @@ -459,7 +459,7 @@ public void checkExtract() { @Test public void testLongExtract() { - this.qs(""" + this.qst(""" SELECT EXTRACT(DECADE FROM INTERVAL '100' years); extract --------- @@ -512,7 +512,7 @@ public void testLongExtract() { @Test public void testCastString() { // These are not from postgres - this.qs(""" + this.qst(""" SELECT CAST(INTERVAL 1 YEARS AS VARCHAR); x --- @@ -552,7 +552,7 @@ public void testCastString() { @Test public void doubleCastTest() { - this.qs(""" + this.qst(""" SELECT CAST(CAST(INTERVAL '1 02:03:04.5' DAYS TO SECONDS AS INTERVAL DAYS) AS VARCHAR); x --- @@ -616,7 +616,7 @@ public void doubleCastTest() { @Test public void testCastShortIntervalToString() { - this.qs(""" + this.qst(""" SELECT CAST(INTERVAL '1 02:03:04.5' DAYS TO SECONDS AS VARCHAR); x --- @@ -729,7 +729,7 @@ public void testCastShortIntervalToString() { @Test public void testCastToInterval() { // These are not from postgres - this.qs(""" + this.qst(""" SELECT CAST(1 AS INTERVAL YEARS); x --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresLimitTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresLimitTests.java index 32c938c7c89..c2892900ceb 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresLimitTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresLimitTests.java @@ -43,7 +43,7 @@ CREATE TABLE onek ( @Test public void testLimit() { // removed empty columns from test. - this.qs(""" + this.qst(""" SELECT unique1, unique2, stringu1 FROM onek WHERE unique1 > 50 ORDER BY unique1 LIMIT 2; @@ -77,7 +77,7 @@ public void testLimit() { @Test public void testOffset() { - this.qs(""" + this.qst(""" SELECT unique1, unique2, stringu1 FROM onek WHERE unique1 > 100 ORDER BY unique1 LIMIT 3 OFFSET 20; diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresNumericTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresNumericTests.java index 4aebb8506f7..4b7db65d397 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresNumericTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresNumericTests.java @@ -773,7 +773,7 @@ public void testDivByZero() { // this is not a postgres test @Test public void testModuloMinusOne() { - this.qs(""" + this.qst(""" SELECT 2::DECIMAL % -1::DECIMAL; decimal --------- @@ -791,7 +791,7 @@ public void testModuloMinusOne() { @Test public void testModulo() { - this.qs(""" + this.qst(""" select 1.12 % 0.3; ?column? ---------- @@ -873,7 +873,7 @@ SELECT x, sqrt(x) @Test public void testExp() { - this.qs(""" + this.qst(""" -- -- Tests for EXP() -- @@ -920,7 +920,7 @@ public void testExp() { @Test public void testSqrtError() { - this.qs(""" + this.qst(""" SELECT sqrt('-1'::numeric), sqrt(-1e0); d | d ----------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresStringTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresStringTests.java index 2438a622d40..032181fbfba 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresStringTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresStringTests.java @@ -222,7 +222,7 @@ public void testCharTbl() { @Test public void testTrimConstant() { - this.qs(""" + this.qst(""" SELECT TRIM(BOTH FROM ' bunch o blanks ') = 'bunch o blanks' AS "bunch o blanks"; bunch o blanks ---------------- @@ -251,7 +251,7 @@ public void testTrimConstant() { @Test public void testTrim() { - this.qs(""" + this.qst(""" SELECT TRIM(BOTH FROM ' bunch o blanks ') = 'bunch o blanks' AS "bunch o blanks"; bunch o blanks ---------------- @@ -283,7 +283,7 @@ public void testTrimArg() { @Test public void testSubstring() { - this.qs(""" + this.qst(""" SELECT SUBSTRING('1234567890' FROM 3) = '34567890' AS "34567890"; 34567890 ---------- @@ -381,7 +381,7 @@ public void testOverlay() { @Test @Ignore("regexp_replace with 4 arguments not implemented") public void testRegexpReplace() { - this.qs(""" + this.qst(""" SELECT regexp_replace('1112223333', E'(\\\\d{3})(\\\\d{3})(\\\\d{4})', E'(\\\\1) \\\\2-\\\\3'); regexp_replace ---------------- @@ -491,7 +491,7 @@ public void testRegexpReplace() { @Test public void testLike2() { - this.qs(""" + this.qst(""" SELECT 'hawkeye' LIKE 'h%' AS "true"; true ------ @@ -580,7 +580,7 @@ public void testLike2() { @Test public void testRlike() { // This is not a postgres operator - this.qs(""" + this.qst(""" SELECT 'hawkeye' RLIKE 'h.*' AS "true"; true ------ @@ -867,36 +867,41 @@ public void testILike2() { @Test public void testLikeCombinations() { - this.q(""" + this.qs(""" SELECT 'foo' LIKE '_%' as t, 'f' LIKE '_%' as t0, '' LIKE '_%' as f; t | t0 | f ---+----+--- - t | t | f"""); - this.q(""" + t | t | f + (1 row) + SELECT 'foo' LIKE '%_' as t, 'f' LIKE '%_' as t0, '' LIKE '%_' as f; t | t0 | f ---+----+--- - t | t | f"""); - this.q(""" + t | t | f + (1 row) + SELECT 'foo' LIKE '__%' as t, 'foo' LIKE '___%' as t0, 'foo' LIKE '____%' as f; t | t0 | f ---+----+--- - t | t | f"""); - this.q(""" + t | t | f + (1 row) + SELECT 'foo' LIKE '%__' as t, 'foo' LIKE '%___' as t0, 'foo' LIKE '%____' as f; t | t0 | f ---+----+--- - t | t | f"""); - this.q(""" + t | t | f + (1 row) + SELECT 'jack' LIKE '%____%' AS t; t --- - t"""); + t + (1 row)"""); } @Test public void testLikeNull() { - this.qs(""" + this.qst(""" SELECT NULL LIKE '%'; result ------- @@ -986,7 +991,7 @@ public void testConcatConversions() { @Test public void testLength() { // added a few more aliases supported from other dialects - this.qs(""" + this.qst(""" SELECT char_length('abcdef') AS "length_6"; length_6 ---------- @@ -1069,7 +1074,7 @@ public void testReplace() { @Test public void testSplitPart() { - this.qs(""" + this.qst(""" SELECT split_part('abc~@~def~@~ghi', '~@~', 1) AS result; result ------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresTimeTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresTimeTests.java index 58b0e07c0f5..0e31e26fa7d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresTimeTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresTimeTests.java @@ -26,7 +26,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void testTime() { - this.qs(""" + this.qst(""" SELECT f1 AS "Time" FROM TIME_TBL; Time ------------- @@ -85,7 +85,7 @@ public void testTime() { @Test public void testConstants() { - this.qs(""" + this.qst(""" -- Check edge cases SELECT '23:59:59.999999'::time; time @@ -123,7 +123,7 @@ public void testFailPlus() { public void testUnits() { // Removed dates // Extract second and millisecond return integers in Calcite instead of DECIMAL - this.qs(""" + this.qst(""" SELECT EXTRACT(MICROSECOND FROM TIME '13:30:25.575401'); extract ---------- @@ -180,7 +180,7 @@ public void illegalUnits() { @Test public void testDatePart() { - this.qs(""" + this.qst(""" SELECT date_part(microsecond, TIME '13:30:25.575401'); date_part ----------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresWindowTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresWindowTests.java index 6dd0df2ec88..e08b9514a47 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresWindowTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/postgres/PostgresWindowTests.java @@ -113,29 +113,29 @@ CREATE TABLE tenk1_1_small ( @Test public void testWindow() { - this.qs(""" + this.qst(""" SELECT depname, empno, salary, sum(salary) OVER (PARTITION BY depname) FROM empsalary -- ORDER BY depname, salary ; depname | empno | salary | sum -----------+-------+--------+------- - develop| 7 | 4200 | 25100 - develop| 9 | 4500 | 25100 - develop| 11 | 5200 | 25100 - develop| 10 | 5200 | 25100 - develop| 8 | 6000 | 25100 - personnel| 5 | 3500 | 7400 - personnel| 2 | 3900 | 7400 - sales| 3 | 4800 | 14600 - sales| 4 | 4800 | 14600 - sales| 1 | 5000 | 14600 + develop | 7 | 4200 | 25100 + develop | 9 | 4500 | 25100 + develop | 11 | 5200 | 25100 + develop | 10 | 5200 | 25100 + develop | 8 | 6000 | 25100 + personnel | 5 | 3500 | 7400 + personnel | 2 | 3900 | 7400 + sales | 3 | 4800 | 14600 + sales | 4 | 4800 | 14600 + sales | 1 | 5000 | 14600 (10 rows)"""); } @Test public void testLeadLag() { - this.qs(""" + this.qst(""" SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1_2_small WHERE unique2 < 10; lag | ten | four @@ -206,7 +206,7 @@ SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four @Test public void testPreceding() { - this.qs(""" + this.qst(""" SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding), unique1, four FROM tenk1_1_small WHERE unique1 < 10; @@ -245,7 +245,7 @@ SELECT sum(unique1) over (partition by four order by unique1 range between 5::in @Test public void testWindowDescOrder() { - this.qs(""" + this.qst(""" SELECT sum(unique1) over (order by four desc range between 2::int8 preceding and 1::int2 preceding), unique1, four FROM tenk1_1_small WHERE unique1 < 10; @@ -268,7 +268,7 @@ SELECT sum(unique1) over (order by four desc range between 2::int8 preceding and public void dateWindow() { // around line 1534 // Converted INTERVAL 1 YEAR to INTERVAL 365 DAYS - this.qs(""" + this.qst(""" select sum(salary) OVER (order by enroll_date range between INTERVAL 365 DAYS preceding and INTERVAL 365 DAYS following), salary, enroll_date FROM empsalary; @@ -308,7 +308,7 @@ select sum(salary) @Test public void degenerateCases() { - this.qs(""" + this.qst(""" select f1, sum(f1) over (partition by f1 order by f2 range between 1 preceding and 1 following) from t1 where f1 = f2; @@ -339,7 +339,7 @@ select f1, sum(f1) over (partition by f1, f2 order by f2 @Test public void testTopK() { - this.qs(""" + this.qst(""" SELECT * FROM (SELECT empno, row_number() OVER (ORDER BY empno) rn @@ -431,12 +431,12 @@ public void testTopK() { WHERE rn < 3; empno | depname | rn -------+-----------+---- - 7 | develop| 1 - 8 | develop| 2 - 2 | personnel| 1 - 5 | personnel| 2 - 1 | sales| 1 - 3 | sales| 2 + 7 | develop | 1 + 8 | develop | 2 + 2 | personnel | 1 + 5 | personnel | 2 + 1 | sales | 1 + 3 | sales | 2 (6 rows) SELECT * FROM @@ -448,21 +448,21 @@ public void testTopK() { WHERE c <= 3; empno | depname | salary | c -------+-----------+--------+--- - 8 | develop| 6000 | 1 - 10 | develop| 5200 | 3 - 11 | develop| 5200 | 3 - 2 | personnel| 3900 | 1 - 5 | personnel| 3500 | 2 - 1 | sales| 5000 | 1 - 4 | sales| 4800 | 3 - 3 | sales| 4800 | 3 + 8 | develop | 6000 | 1 + 10 | develop | 5200 | 3 + 11 | develop | 5200 | 3 + 2 | personnel | 3900 | 1 + 5 | personnel | 3500 | 2 + 1 | sales | 5000 | 1 + 4 | sales | 4800 | 3 + 3 | sales | 4800 | 3 (8 rows) """); } @Test @Ignore("Lead with variable amounts not supported") public void testLeadLagVariable() { - this.qs(""" + this.qst(""" select x, lag(x, 1) over (order by x), lead(x, 3) over (order by x) from series; x | lag | lead diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggScottTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggScottTests.java index fb3bf46b6c1..45ed29e47dc 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggScottTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggScottTests.java @@ -8,7 +8,7 @@ public class AggScottTests extends ScottBaseTests { @Test public void testCalcite6403() { - this.qs(""" + this.qst(""" SELECT COUNT(*), COUNT(DISTINCT deptno) FROM emp WHERE false; c0 | c1 --------- @@ -18,7 +18,7 @@ public void testCalcite6403() { @Test public void testPairs() { - this.qs(""" + this.qst(""" select comm, (comm, comm) in ((500, 500), (300, 300), (0, 0)) from emp; comm | in ----------- @@ -42,7 +42,7 @@ public void testPairs() { @Test @Ignore("Cannot decorrelate LATERAL join") public void testLateral() { - this.qs(""" + this.qst(""" SELECT deptno, ename FROM (SELECT DISTINCT deptno FROM emp) t1, @@ -435,7 +435,7 @@ group by grouping sets ((job, deptno, comm is null), @Test public void testSimple() { - this.qs(""" + this.qst(""" -- [KYLIN-751] Max on negative double values is not working -- [CALCITE-735] Primitive.DOUBLE.min should be large and negative select max(v) as x, min(v) as n @@ -513,7 +513,7 @@ SELECT SUM( @Test @Ignore("fusion, collect not yet implemented") public void testFusion() { - this.qs(""" + this.qst(""" -- FUSION rolled up using CARDINALITY select cardinality(fusion(empnos)) as f_empnos_length from ( @@ -611,7 +611,7 @@ select deptno, collect(empno) filter (where empno < 7550) as empnos @Test public void testConditionalAggregate() { - this.qs(""" + this.qst(""" -- Aggregate FILTER select deptno, sum(sal) filter (where job = 'CLERK') c_sal, @@ -665,7 +665,7 @@ public void testConditionalAggregate() { // select the ordered field is compiled incorrectly @Test public void testOrderByFilter() { - this.qs(""" + this.qst(""" -- Aggregate FILTER with ORDER BY select deptno from emp @@ -683,7 +683,7 @@ public void testOrderByFilter() { @Test public void testAggregates() { - this.qs(""" + this.qst(""" -- Aggregate FILTER with JOIN select dept.deptno, sum(sal) filter (where 1 < 2) as s, @@ -797,7 +797,7 @@ select count(*) filter (where (x = 0) is false) as c @Test public void testCompositeCount() { - this.qs(""" + this.qst(""" -- Composite COUNT and FILTER select count(*) as c, count(*) filter (where z > 1) as cf, @@ -816,7 +816,7 @@ select count(*) as c, @Test public void testAggregates2() { - this.qs(""" + this.qst(""" select count(distinct deptno) as cd, count(*) as c from emp group by deptno; @@ -832,7 +832,7 @@ select count(distinct deptno) as cd, count(*) as c @Test public void testDistinctAggregates() { - this.qs(""" + this.qst(""" select deptno, count(distinct deptno) as c from emp group by deptno; @@ -860,7 +860,7 @@ select count(distinct deptno) as c @Test public void testCubeDistinct() { - this.qs(""" + this.qst(""" select count(distinct deptno) as cd, count(*) as c from emp group by cube(deptno); @@ -878,7 +878,7 @@ select count(distinct deptno) as cd, count(*) as c @Test public void testDistinctCount() { // These tests cannot be run without optimizations. - this.qs(""" + this.qst(""" -- Multiple distinct count and non-distinct aggregates select deptno, count(distinct job) as dj, @@ -926,7 +926,7 @@ select count(distinct job) as dj, @Test public void testAvg() { - this.qs(""" + this.qst(""" select avg(comm) as a, count(comm) as c from emp where empno < 7844; +-------------------+---+ @@ -939,7 +939,7 @@ select avg(comm) as a, count(comm) as c from @Test public void testAggregates3() { - this.qs(""" + this.qst(""" -- [CALCITE-846] Push aggregate with FILTER through UNION ALL select deptno, count(*) filter (where job = 'CLERK') as cf, count(*) as c from ( @@ -1177,7 +1177,7 @@ select sum(m.sal) as s @Test public void testNestedOrderby() { - this.qs(""" + this.qst(""" -- Collation of LogicalAggregate ([CALCITE-783] and [CALCITE-822]) select sum(x) as sum_cnt, count(distinct y) as cnt_dist @@ -1206,7 +1206,7 @@ select sum(x) as sum_cnt, @Test public void testAggregates4() { - this.qs(""" + this.qst(""" -- [CALCITE-938] Aggregate row count select empno, d.deptno from emp @@ -1641,7 +1641,7 @@ SELECT job, AVG(avg_sal) AS avg_sal2 @Test public void testAgg4() { - this.qs(""" + this.qst(""" -- [CALCITE-1930] AggregateExpandDistinctAggregateRules should handle multiple aggregate calls with same input ref select count(distinct EMPNO), COUNT(SAL), MIN(SAL), MAX(SAL) from emp; +--------+--------+--------+---------+ @@ -1693,7 +1693,7 @@ public void testAgg4() { @Test @Ignore("Several not-implemented aggregation functions") public void testRegrValue() { - this.qs(""" + this.qst(""" -- [CALCITE-1776, CALCITE-2402] REGR_COUNT SELECT regr_count(COMM, SAL) as "REGR_COUNT(COMM, SAL)", regr_count(EMPNO, SAL) as "REGR_COUNT(EMPNO, SAL)" @@ -1736,7 +1736,7 @@ SELECT regr_count(COMM, SAL) as "REGR_COUNT(COMM, SAL)", @Test public void bitTests() { - this.qs(""" + this.qst(""" -- BIT_AND, BIT_OR, BIT_XOR aggregate functions select bit_and(deptno), bit_or(deptno), bit_xor(deptno) from emp; +--------+--------+--------+ diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggTests.java index 54ed3a28ffe..7b4f66695cd 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AggTests.java @@ -16,26 +16,26 @@ left join dept as s on (select true from emp)""", @Test public void calciteIssue6520() { - this.qs(""" + this.qst(""" SELECT ENAME, ENAME in ('Adam', 'Alice', 'Eve') FROM EMP; ename | expr -------------- - Adam| true - Alice| true - Bob| false - Eric| false - Eve| true - Grace| false - Jane| false - Susan| false - Wilma| false + Adam | true + Alice | true + Bob | false + Eric | false + Eve | true + Grace | false + Jane | false + Susan | false + Wilma | false --------------- (9 rows)"""); } @Test public void testCompositeCount() { - this.qs(""" + this.qst(""" -- composite count select count(deptno, ename, 1, deptno) as c from emp; +---+ @@ -67,9 +67,9 @@ public void testCompositeCount() { +----+---+ | M | C | +----+---+ - | 0 | F| + | 0 | F | | 10 |NULL| - | 0 | M| + | 0 | M | +----+---+ (3 rows) @@ -93,7 +93,7 @@ public void testCompositeCount() { @Test public void testAggregates() { - this.qs(""" + this.qst(""" -- count(*) returns number of rows in table select count(ename) as c from emp; +---+ @@ -194,7 +194,7 @@ select distinct count(*) as c from emp group by deptno order by 1 desc @Test public void issue1901() { - this.qs(""" + this.qst(""" select stddev(value) FROM (VALUES (.1e0), (.1e0), (.1e0)) t1(value) WHERE true; result ------ @@ -204,7 +204,7 @@ public void issue1901() { @Test public void stddevTests() { - this.qs(""" + this.qst(""" -- Our own test, for denominator of 0 in SAMP select stddev_samp(deptno) as s from emp WHERE deptno = 60; +----+ @@ -263,8 +263,8 @@ public void stddevTests() { +--------+----+----+----+---+ | GENDER | P | S | SS | C | +--------+----+----+----+---+ - | F| 17 | 19 | 19 | 5 | - | M| 17 | 20 | 20 | 3 | + | F | 17 | 19 | 19 | 5 | + | M | 17 | 20 | 20 | 3 | +--------+----+----+----+---+ (2 rows)"""); } @@ -272,7 +272,7 @@ public void stddevTests() { @Test @Ignore("multiset not yet implemented") public void testIntersection() { - this.qs(""" + this.qst(""" -- [CALCITE-3815] Add missing SQL standard aggregate -- functions: EVERY, SOME, INTERSECTION select some(deptno = 100), every(deptno > 0), intersection(multiset[1, 2]) from emp; @@ -286,7 +286,7 @@ public void testIntersection() { @Test public void testEvery() { - this.qs(""" + this.qst(""" select some(deptno > 100), every(deptno > 0) from emp where deptno > 1000; +--------+--------+ | EXPR$0 | EXPR$1 | @@ -299,16 +299,16 @@ public void testEvery() { @Test public void simpleTests() { - this.qs(""" + this.qst(""" select city, gender as c from emps; +---------------+---+ | CITY | C | +---------------+---+ - | Vancouver| F| - | San Francisco| M| - |NULL|NULL| - | Vancouver| M| - |NULL| F| + | Vancouver | F | + | San Francisco | M | + |NULL |NULL| + | Vancouver | M | + |NULL | F | +---------------+---+ (5 rows) @@ -317,11 +317,11 @@ public void simpleTests() { +---------------+--------+ | CITY | GENDER | +---------------+--------+ - |NULL|NULL| - | Vancouver| M| - |NULL| F| - | San Francisco| M| - | Vancouver| F| + |NULL |NULL | + | Vancouver | M | + |NULL | F | + | San Francisco | M | + | Vancouver | F | +---------------+--------+ (5 rows) @@ -344,7 +344,7 @@ C BIGINT(19) NOT NULL @Test public void testGroupingSets() { - this.qs(""" + this.qst(""" -- Basic GROUPING SETS select deptno, count(*) as c from emps group by grouping sets ((), (deptno)); +--------+---+ @@ -385,7 +385,7 @@ public void testGroupingSets() { @Test public void testRollup() { - this.qs(""" + this.qst(""" -- CUBE select deptno + 1, count(*) as c from emp group by cube(deptno, gender); +--------+---+ @@ -435,21 +435,21 @@ public void testRollup() { +--------+--------+---+ | GENDER | EXPR$1 | C | +--------+--------+---+ - | M| 21 | 1 | - | F| 11 | 1 | - | F| 31 | 2 | - | F| 51 | 1 | - | F| 61 | 1 | - | F| | 1 | - | M| 11 | 1 | - | M| 51 | 1 | - |NULL| 11 | 2 | - |NULL| 21 | 1 | - |NULL| 31 | 2 | - |NULL| 51 | 2 | - |NULL| 61 | 1 | - |NULL| | 1 | - |NULL| | 9 | + | M | 21 | 1 | + | F | 11 | 1 | + | F | 31 | 2 | + | F | 51 | 1 | + | F | 61 | 1 | + | F | | 1 | + | M | 11 | 1 | + | M | 51 | 1 | + |NULL | 11 | 2 | + |NULL | 21 | 1 | + |NULL | 31 | 2 | + |NULL | 51 | 2 | + |NULL | 61 | 1 | + |NULL | | 1 | + |NULL | | 9 | +--------+--------+---+ (15 rows) @@ -461,9 +461,9 @@ select gender, count(*) as c +--------+---+ | GENDER | C | +--------+---+ - | F| 6 | - | M| 3 | - |NULL| 9 | + | F | 6 | + | M | 3 | + |NULL | 9 | +--------+---+ (3 rows) @@ -476,9 +476,9 @@ group by rollup(gender) +--------+---+ | GENDER | C | +--------+---+ - |NULL| 9 | - | F| 6 | - | M| 3 | + |NULL | 9 | + | F | 6 | + | M | 3 | +--------+---+ (3 rows) @@ -605,18 +605,18 @@ group by rollup(deptno) +--------+--------+--------+ | DEPTNO | GENDER | EXPR$2 | +--------+--------+--------+ - | 20 | M| 1 | - | 20 | M| 1 | - | 20 | M| 1 | - | 20 | M| 1 | - | 20 | M| 1 | - | 20 | M| 1 | - | 20 | M| 1 | - | 20 |NULL| 1 | - | 20 |NULL| 1 | - | 20 |NULL| 1 | - | | M| 1 | - | |NULL| 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 | M | 1 | + | 20 |NULL | 1 | + | 20 |NULL | 1 | + | 20 |NULL | 1 | + | | M | 1 | + | |NULL | 1 | +--------+--------+--------+ (12 rows) @@ -625,17 +625,17 @@ group by rollup(deptno) +--------+--------+--------+ | DEPTNO | GENDER | EXPR$2 | +--------+--------+--------+ - | 20 | M| 1 | - | 20 |NULL| 1 | - | | M| 1 | - | |NULL| 1 | + | 20 | M | 1 | + | 20 |NULL | 1 | + | | M | 1 | + | |NULL | 1 | +--------+--------+--------+ (4 rows)"""); } @Test public void testCornerCases() { - this.qs(""" + this.qst(""" -- GROUP BY over empty columns select count(*) from emp where deptno = 20 group by (); +--------+ @@ -666,7 +666,7 @@ public void testCornerCases() { @Test public void testGrouping() { - this.qs(""" + this.qst(""" -- CUBE and JOIN select e.deptno, e.gender, min(e.ename) as min_name from emp as e join dept as d using (deptno) @@ -675,10 +675,10 @@ group by cube(e.deptno, d.deptno, e.gender) +--------+--------+----------+ | DEPTNO | GENDER | MIN_NAME | +--------+--------+----------+ - | 10 | M| Bob| - | 10 | M| Bob| - | | F| Alice| - | |NULL| Alice| + | 10 | M | Bob | + | 10 | M | Bob | + | | F | Alice | + | |NULL | Alice | +--------+--------+----------+ (4 rows) @@ -785,11 +785,11 @@ select deptno, gender, grouping_id(deptno, gender, deptno), count(*) as c +--------+--------+--------+---+ | DEPTNO | GENDER | EXPR$2 | C | +--------+--------+--------+---+ - | 10 | F| 0 | 1 | - | 10 | M| 0 | 1 | - | | F| 5 | 1 | - | | M| 5 | 1 | - | |NULL| 7 | 2 | + | 10 | F | 0 | 1 | + | 10 | M | 0 | 1 | + | | F | 5 | 1 | + | | M | 5 | 1 | + | |NULL | 7 | 2 | +--------+--------+--------+---+ (5 rows) @@ -819,30 +819,30 @@ select deptno, gender, grouping(deptno) gd, grouping(gender) gg, +--------+--------+----+----+----+----+-----+---+ | DEPTNO | GENDER | GD | GG | DG | GD | GID | C | +--------+--------+----+----+----+----+-----+---+ - | 10 | F| 0 | 0 | 0 | 0 | 0 | 1 | - | 10 | M| 0 | 0 | 0 | 0 | 0 | 1 | - | 20 | M| 0 | 0 | 0 | 0 | 0 | 1 | - | 30 | F| 0 | 0 | 0 | 0 | 0 | 2 | - | 50 | F| 0 | 0 | 0 | 0 | 0 | 1 | - | 50 | M| 0 | 0 | 0 | 0 | 0 | 1 | - | 60 | F| 0 | 0 | 0 | 0 | 0 | 1 | - | | F| 0 | 0 | 0 | 0 | 0 | 1 | - | |NULL| 1 | 1 | 3 | 3 | 0 | 9 | - | 10 |NULL| 0 | 1 | 1 | 2 | 0 | 2 | - | 20 |NULL| 0 | 1 | 1 | 2 | 0 | 1 | - | 30 |NULL| 0 | 1 | 1 | 2 | 0 | 2 | - | 50 |NULL| 0 | 1 | 1 | 2 | 0 | 2 | - | 60 |NULL| 0 | 1 | 1 | 2 | 0 | 1 | - | | F| 1 | 0 | 2 | 1 | 0 | 6 | - | | M| 1 | 0 | 2 | 1 | 0 | 3 | - | |NULL| 0 | 1 | 1 | 2 | 0 | 1 | + | 10 | F | 0 | 0 | 0 | 0 | 0 | 1 | + | 10 | M | 0 | 0 | 0 | 0 | 0 | 1 | + | 20 | M | 0 | 0 | 0 | 0 | 0 | 1 | + | 30 | F | 0 | 0 | 0 | 0 | 0 | 2 | + | 50 | F | 0 | 0 | 0 | 0 | 0 | 1 | + | 50 | M | 0 | 0 | 0 | 0 | 0 | 1 | + | 60 | F | 0 | 0 | 0 | 0 | 0 | 1 | + | | F | 0 | 0 | 0 | 0 | 0 | 1 | + | |NULL | 1 | 1 | 3 | 3 | 0 | 9 | + | 10 |NULL | 0 | 1 | 1 | 2 | 0 | 2 | + | 20 |NULL | 0 | 1 | 1 | 2 | 0 | 1 | + | 30 |NULL | 0 | 1 | 1 | 2 | 0 | 2 | + | 50 |NULL | 0 | 1 | 1 | 2 | 0 | 2 | + | 60 |NULL | 0 | 1 | 1 | 2 | 0 | 1 | + | | F | 1 | 0 | 2 | 1 | 0 | 6 | + | | M | 1 | 0 | 2 | 1 | 0 | 3 | + | |NULL | 0 | 1 | 1 | 2 | 0 | 1 | +--------+--------+----+----+----+----+-----+---+ (17 rows)"""); } @Test public void testAgg() { - this.qs(""" + this.qst(""" -- [CALCITE-1781] Allow expression in CUBE and ROLLUP select deptno + 1 as d1, deptno + 1 - 1 as d0, count(*) as c from emp @@ -866,16 +866,16 @@ select mod(deptno, 20) as d, count(*) as c, gender as g +----+---+---+ | D | C | G | +----+---+---+ - | 0 | 1 | F| - | 0 | 1 | M| + | 0 | 1 | F | + | 0 | 1 | M | | 0 | 2 |NULL| - | 10 | 2 | M| - | 10 | 4 | F| + | 10 | 2 | M | + | 10 | 4 | F | | 10 | 6 |NULL| - | | 1 | F| + | | 1 | F | | | 1 |NULL| - | | 3 | M| - | | 6 | F| + | | 3 | M | + | | 6 | F | | | 9 |NULL| +----+---+---+ (11 rows) @@ -886,13 +886,13 @@ select mod(deptno, 20) as d, count(*) as c, gender as g +----+---+---+ | D | C | G | +----+---+---+ - | 0 | 1 | F| - | 0 | 1 | M| + | 0 | 1 | F | + | 0 | 1 | M | | 0 | 2 |NULL| - | 10 | 2 | M| - | 10 | 4 | F| + | 10 | 2 | M | + | 10 | 4 | F | | 10 | 6 |NULL| - | | 1 | F| + | | 1 | F | | | 1 |NULL| | | 9 |NULL| +----+---+---+ @@ -926,13 +926,13 @@ select count(*) as c } @Test public void t0() { - this.qs(""" + this.qst(""" select distinct '1' from (values (1,2),(3,4)); +--------+ | EXPR$0 | +--------+ - | 1| + | 1 | +--------+ (1 row) @@ -960,7 +960,7 @@ select nullif(count(distinct '1'),0) TODO: setup more tests @Test public void testAggregates() { - this.qs(""" + this.qst(""" !use orinoco -- FLOOR to achieve a 2-hour window @@ -1357,7 +1357,7 @@ select deptno, ename, MODE(gender) as m @Test public void testRowNumber() { - this.qs(""" + this.qst(""" -- Test case for [CALCITE-5388] tempList expression inside EnumerableWindow.getPartitionIterator should be unoptimized with CTE1(rownr1, val1) as ( select ROW_NUMBER() OVER(ORDER BY id ASC), id from (values (1), (2)) as Vals1(id) ), diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AsofTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AsofTests.java index 5b937e37ee8..cf1743bbae3 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AsofTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/AsofTests.java @@ -8,7 +8,7 @@ public class AsofTests extends StreamingTestBase { @Test @Ignore("Only left implemented") public void testAsof() { - this.qs(""" + this.qst(""" SELECT * FROM (VALUES (NULL, 0), (1, NULL), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (3, 4)) AS t1(k, t) ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t) @@ -86,7 +86,7 @@ ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t) @Test public void testLeftAsofGE() { - this.qs(""" + this.qst(""" SELECT * FROM (VALUES (NULL, 0), (1, NULL), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (3, 4)) AS t1(k, t) LEFT ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t) @@ -110,7 +110,7 @@ LEFT ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t) @Test @Ignore("Not all comparisons supported") public void testLeftAsof() { - this.qs(""" + this.qst(""" SELECT * FROM (VALUES (NULL, 0), (1, NULL), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (3, 4)) AS t1(k, t) LEFT ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t) diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/BigQueryTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/BigQueryTests.java index be2cc649667..62b10359b95 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/BigQueryTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/BigQueryTests.java @@ -7,7 +7,7 @@ public class BigQueryTests extends SqlIoTest { @Test public void testSafeCast() { - this.qs(""" + this.qst(""" -- SAFE_CAST(x AS type) -- Identical to CAST(), except it returns NULL instead of raising an error. WITH Casted AS ( @@ -23,11 +23,11 @@ SELECT SAFE_CAST(0 as BOOLEAN), 0, 'boolean' +------------+-------------+------------+ | casted | input | as | +------------+-------------+------------+ - |NULL | a| int| - | a| a| varchar(1)| - | 2023-03-07| 2023-03-07| date| - |NULL | 2023-03-07a| date| - | FALSE| 0| boolean| + |NULL | a | int | + | a | a | varchar(1) | + | 2023-03-07 | 2023-03-07 | date | + |NULL | 2023-03-07a | date | + | FALSE | 0 | boolean | +------------+-------------+------------+ (5 rows) @@ -42,8 +42,8 @@ SELECT SAFE_CAST('12:12:11a' as TIME), '12:12:11a', 'time' +----------+-----------+-----+ | casted | input | as | +----------+-----------+-----+ - | 12:12:11 | 12:12:11| time| - | | 12:12:11a| time| + | 12:12:11 | 12:12:11 | time| + | | 12:12:11a | time| +----------+-----------+-----+ (2 rows) @@ -59,8 +59,8 @@ SELECT SAFE_CAST(FALSE as BOOLEAN) as casted, 'false' as input, +--------+-------+--------+ | casted | input | as | +--------+-------+--------+ - | true | true| boolean| - | false | false| boolean| + | true | true | boolean| + | false | false | boolean| +--------+-------+--------+ (2 rows) @@ -78,9 +78,9 @@ SELECT SAFE_CAST(null as interval year), 'null', 'interval year' +--------+------------------+--------------+ | casted | input | as | +--------+------------------+--------------+ - | 1 year | interval 1 month| interval year| - | | a| interval year| - | | null| interval year| + | 1 year | interval 1 month | interval year| + | | a | interval year | + | | null | interval year| +--------+------------------+--------------+ (3 rows) @@ -97,8 +97,8 @@ SELECT SAFE_CAST('a' as interval minute to second), +---------------+-----------------------------+--------------------------+ | casted | input | as | +---------------+-----------------------------+--------------------------+ - | 61 mins | interval 1:1 hour to minute| interval minute to second| - | | a| interval minute to second| + | 61 mins | interval 1:1 hour to minute | interval minute to second| + | | a | interval minute to second| +---------------+-----------------------------+--------------------------+ (2 rows) @@ -116,16 +116,16 @@ SELECT SAFE_CAST(1 as BIGINT), '1', 'bigint' -- UNION ALL +--------+-------+-------+ | casted | input | as | +--------+-------+-------+ - | | true| bigint| - | 1 | 1.0| bigint| - | 1 | 1| bigint| + | | true | bigint| + | 1 | 1.0 | bigint| + | 1 | 1 | bigint| +--------+-------+-------+ (3 rows)"""); } @Test public void testRegexpReplace() { - this.qs(""" + this.qst(""" -- REGEXP_REPLACE(value, regexp, replacement) -- -- Returns a STRING where all substrings of value that match regexp are replaced with replacement. @@ -166,7 +166,7 @@ public void negativeTestParseDate() { // pattern insufficient for hour this.qf("SELECT PARSE_TIMESTAMP('%a %b %e %I:%M:%S %Y', 'Thu Dec 25 07:30:00 2008')", "Invalid format in PARSE_TIMESTAMP"); - this.qs(""" + this.qst(""" -- 30 hour is out of range SELECT PARSE_TIME('%S:%I:%M', '07:30:00'); r @@ -212,7 +212,7 @@ public void negativeTestParseDate() { @Test public void testParseDate() { // These have been adapted, since these functions are not compatible with BigQuery. - this.qs(""" + this.qst(""" SELECT PARSE_DATE('%A %b %e %Y', 'Thursday Dec 25 2008'); +------------+ | EXPR$0 | diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/CalciteJdbcTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/CalciteJdbcTests.java index ab67366249e..ed6138de114 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/CalciteJdbcTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/CalciteJdbcTests.java @@ -8,16 +8,16 @@ public class CalciteJdbcTests extends HrBaseTests { // validated on Postgres @Test public void testWinAggFirstValue() { - this.qs(""" + this.qst(""" select deptno, empid, commission, first_value(commission) over (partition by deptno order by empid) as r from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | 1000 - 10 | 110 | 250 | 1000 - 10 | 150 | null | 1000 - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | 1000 + 10 | 110 | 250 | 1000 + 10 | 150 | null | 1000 + 20 | 200 | 500 | 500 (4 rows) select deptno, empid, commission, @@ -40,10 +40,10 @@ public void testWinAggFirstValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | 1000 - 10 | 110 | 250 | 1000 - 10 | 150 | null | 1000 - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | 1000 + 10 | 110 | 250 | 1000 + 10 | 150 | null | 1000 + 20 | 200 | 500 | 500 (4 rows) -- same query with different explicit bounds @@ -55,10 +55,10 @@ public void testWinAggFirstValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | 1000 - 10 | 110 | 250 | 1000 - 10 | 150 | null | 1000 - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | 1000 + 10 | 110 | 250 | 1000 + 10 | 150 | null | 1000 + 20 | 200 | 500 | 500 (4 rows) -- same query with range explicit bounds @@ -70,10 +70,10 @@ public void testWinAggFirstValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | 1000 - 10 | 110 | 250 | 1000 - 10 | 150 | null | 1000 - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | 1000 + 10 | 110 | 250 | 1000 + 10 | 150 | null | 1000 + 20 | 200 | 500 | 500 (4 rows) -- same query with a different explicit bounds @@ -85,17 +85,17 @@ public void testWinAggFirstValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | 1000 - 10 | 110 | 250 | 1000 - 10 | 150 | null | 1000 - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | 1000 + 10 | 110 | 250 | 1000 + 10 | 150 | null | 1000 + 20 | 200 | 500 | 500 (4 rows)"""); } @Test public void testWinAggLastValue() { // validated on postgres - this.qs(""" + this.qst(""" -- same query with different explicit bounds select deptno, empid, commission, last_value(commission) over ( @@ -105,10 +105,10 @@ public void testWinAggLastValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | NULL - 10 | 110 | 250 | NULL - 10 | 150 | null | NULL - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | NULL + 10 | 110 | 250 | NULL + 10 | 150 | null | NULL + 20 | 200 | 500 | 500 (4 rows) -- same query with range explicit bounds @@ -120,10 +120,10 @@ public void testWinAggLastValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | NULL - 10 | 110 | 250 | NULL - 10 | 150 | null | NULL - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | NULL + 10 | 110 | 250 | NULL + 10 | 150 | null | NULL + 20 | 200 | 500 | 500 (4 rows) -- same query with a different explicit bounds @@ -135,10 +135,10 @@ public void testWinAggLastValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | NULL - 10 | 110 | 250 | NULL - 10 | 150 | null | NULL - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | NULL + 10 | 110 | 250 | NULL + 10 | 150 | null | NULL + 20 | 200 | 500 | 500 (4 rows) -- same query with a different explicit bounds @@ -150,16 +150,16 @@ public void testWinAggLastValue() { from emps; deptno | empid | commission | R --------------------------------- - 10 | 100 | 1000 | NULL - 10 | 110 | 250 | NULL - 10 | 150 | null | NULL - 20 | 200 | 500 | 500 + 10 | 100 | 1000 | NULL + 10 | 110 | 250 | NULL + 10 | 150 | null | NULL + 20 | 200 | 500 | 500 (4 rows)"""); } @Test @Ignore("FIRST_VALUE with bounded range not supported") public void testBoundedFirstValue() { - this.qs(""" + this.qst(""" select deptno, empid, commission, first_value(commission) over (partition by deptno order by empid desc range between 1000 preceding and 999 preceding) as r diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/FoodmartTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/FoodmartTests.java index 9c59e1f3eb3..cf82c454802 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/FoodmartTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/FoodmartTests.java @@ -16,19 +16,20 @@ public void testQualify() { @Test public void testSelect() { - this.q(""" + this.qst(""" SELECT * FROM DEPT; - DEPT NO | DNAME | LOC - --------------------- - 10 | ACCOUNTING| NEW YORK - 20 | RESEARCH| DALLAS - 30 | SALES| CHICAGO - 40 | OPERATIONS| BOSTON"""); + DEPT NO | DNAME | LOC + --------------------------------- + 10 | ACCOUNTING | NEW YORK + 20 | RESEARCH | DALLAS + 30 | SALES | CHICAGO + 40 | OPERATIONS | BOSTON + (4 rows)"""); } @Test public void testScalar() { - this.qs(""" + this.qst(""" select deptno, (select min(empno) from emp where deptno = dept.deptno) as x from dept; +--------+------+ | DEPTNO | X | @@ -143,7 +144,7 @@ public void testScalar() { @Test @Ignore("Cannot be decorrelated (generates LATERAL)") public void limitTests() { - this.qs(""" + this.qst(""" select deptno, (select sum(empno) from emp where deptno = dept.deptno limit 1) as x from dept; +--------+----------------------+ | DEPTNO | X | diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/HRWinAggTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/HRWinAggTests.java index 6c10ec841dc..83cfb3e6493 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/HRWinAggTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/HRWinAggTests.java @@ -8,7 +8,7 @@ public class HRWinAggTests extends HrBaseTests { @Test @Ignore("ORDER BY strings not supported https://github.com/feldera/feldera/issues/457, first_value") public void testWin() { - this.qs(""" + this.qst(""" -- [CALCITE-2081] Two windows under a JOIN select a.deptno, a.r as ar, b.r as br from ( @@ -56,7 +56,7 @@ window w as (partition by "deptno" order by "commission")) b @Test public void test1() { - this.qs(""" + this.qst(""" select * from ( select "empid", count(*) over () c from "emps" diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/MiscTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/MiscTests.java index e0f838cc6af..e745d6b9df2 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/MiscTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/MiscTests.java @@ -7,7 +7,7 @@ public class MiscTests extends ScottBaseTests { @Test public void uuidTests() { - this.qs(""" + this.qst(""" SELECT UUID '123e4567-e89b-12d3-a456-426655440000'; +--------------------------------------+ | EXPR$0 | @@ -72,7 +72,7 @@ public void uuidTests() { @Test public void rowTests() { - this.qs(""" + this.qst(""" -- Implicit ROW select deptno, (empno, deptno) as r from emp; @@ -133,7 +133,7 @@ select deptno, row (empno, deptno) as r @Test @Ignore("Requires MULTISET") public void testRowCoalesce() { - this.qs(""" + this.qst(""" -- [CALCITE-877] Allow ROW as argument to COLLECT select deptno, collect(r) as empnos from (select deptno, (empno, deptno) as r @@ -152,7 +152,7 @@ select deptno, collect(r) as empnos @Test public void intervalTests() { // Added tests with decimal and FP - this.qs(""" + this.qst(""" -- [CALCITE-922] Value of INTERVAL literal select deptno * interval '2' day as d2, deptno * interval -'3' hour as h3, @@ -212,7 +212,7 @@ public void intervalTests() { @Test public void intervalDivision() { // Tested on Postgres, the long interval results differ, since postgres computes on days - this.qs(""" + this.qst(""" select interval '2' day / deptno as d2, interval -'3' hour / deptno as h3, interval -'-4' hour / deptno as h4, diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OperatorTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OperatorTests.java index cdcd7fca996..bc23bd7ada1 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OperatorTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OperatorTests.java @@ -7,7 +7,7 @@ public class OperatorTests extends SqlIoTest { @Test public void testRow() { - this.qs(""" + this.qst(""" select T.X[1] as x1 from (VALUES (ROW(ROW(3, 7), ROW(4, 8)))) as T(x, y); +----+ | X1 | @@ -43,7 +43,7 @@ public void testRow() { @Test public void testFloor() { - this.qs(""" + this.qst(""" select floor(timestamp '2025-01-01 10:00:00.123456' to millisecond), floor(timestamp '1950-01-01 10:00:00.123456' to millisecond); t1 | t2 @@ -55,7 +55,7 @@ select floor(timestamp '2025-01-01 10:00:00.123456' to millisecond), @Test public void testIntervalToString() { // Test that months are formatted with two digits - this.qs(""" + this.qst(""" SELECT CAST((INTERVAL '-2-8' YEAR TO MONTH / 2.583) AS VARCHAR); r --- @@ -72,7 +72,7 @@ public void testIntervalToString() { @Test public void testCeilFloor() { // From Calcite operator.iq - this.qs(""" + this.qst(""" select v, case when b then 'ceil' else 'floor' end as op, case when b then ceil(v to year) else floor(v to year) end as y, @@ -85,8 +85,8 @@ case when b then ceil(v to day) else floor(v to day) end as d +------------+-------+------------+------------+------------+------------+------------+ | V | OP | Y | Q | M | W | D | +------------+-------+------------+------------+------------+------------+------------+ - | 2019-07-05 | ceil| 2020-01-01 | 2019-10-01 | 2019-08-01 | 2019-07-07 | 2019-07-05 | - | 2019-07-05 | floor| 2019-01-01 | 2019-07-01 | 2019-07-01 | 2019-06-30 | 2019-07-05 | + | 2019-07-05 | ceil | 2020-01-01 | 2019-10-01 | 2019-08-01 | 2019-07-07 | 2019-07-05 | + | 2019-07-05 | floor | 2019-01-01 | 2019-07-01 | 2019-07-01 | 2019-06-30 | 2019-07-05 | +------------+-------+------------+------------+------------+------------+------------+ (2 rows) @@ -105,8 +105,8 @@ case when b then ceil(v to second) else floor(v to second) end as s +---------------------+-------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+ | V | OP | Y | Q | M | W | D | H | MI | S | +---------------------+-------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+ - | 2019-07-05 12:34:56 | ceil| 2020-01-01 00:00:00 | 2019-10-01 00:00:00 | 2019-08-01 00:00:00 | 2019-07-07 00:00:00 | 2019-07-06 00:00:00 | 2019-07-05 13:00:00 | 2019-07-05 12:35:00 | 2019-07-05 12:34:56 | - | 2019-07-05 12:34:56 | floor| 2019-01-01 00:00:00 | 2019-07-01 00:00:00 | 2019-07-01 00:00:00 | 2019-06-30 00:00:00 | 2019-07-05 00:00:00 | 2019-07-05 12:00:00 | 2019-07-05 12:34:00 | 2019-07-05 12:34:56 | + | 2019-07-05 12:34:56 | ceil | 2020-01-01 00:00:00 | 2019-10-01 00:00:00 | 2019-08-01 00:00:00 | 2019-07-07 00:00:00 | 2019-07-06 00:00:00 | 2019-07-05 13:00:00 | 2019-07-05 12:35:00 | 2019-07-05 12:34:56 | + | 2019-07-05 12:34:56 | floor | 2019-01-01 00:00:00 | 2019-07-01 00:00:00 | 2019-07-01 00:00:00 | 2019-06-30 00:00:00 | 2019-07-05 00:00:00 | 2019-07-05 12:00:00 | 2019-07-05 12:34:00 | 2019-07-05 12:34:56 | +---------------------+-------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+---------------------+ (2 rows) @@ -120,8 +120,8 @@ case when b then ceil(v to second) else floor(v to second) end as s +------------+-------+------------+------------+------------+ | V | OP | H | MI | S | +------------+-------+------------+------------+------------+ - | 12:34:56.7 | ceil| 13:00:00.0 | 12:35:00.0 | 12:34:57.0 | - | 12:34:56.7 | floor| 12:00:00.0 | 12:34:00.0 | 12:34:56.0 | + | 12:34:56.7 | ceil | 13:00:00.0 | 12:35:00.0 | 12:34:57.0 | + | 12:34:56.7 | floor | 12:00:00.0 | 12:34:00.0 | 12:34:56.0 | +------------+-------+------------+------------+------------+ (2 rows)"""); } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OuterTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OuterTests.java index 68a9832a10f..43b090288a3 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OuterTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/OuterTests.java @@ -6,203 +6,203 @@ public class OuterTests extends PostBaseTests { @Test public void testOuter() { - this.qs(""" + this.qst(""" select * from emp; +-------+--------+--------+ | ENAME | DEPTNO | GENDER | +-------+--------+--------+ - | Jane| 10 | F| - | Bob| 10 | M| - | Eric| 20 | M| - | Susan| 30 | F| - | Alice| 30 | F| - | Adam| 50 | M| - | Eve| 50 | F| - | Grace| 60 | F| - | Wilma| | F| + | Jane | 10 | F | + | Bob | 10 | M | + | Eric | 20 | M | + | Susan | 30 | F | + | Alice | 30 | F | + | Adam | 50 | M | + | Eve | 50 | F | + | Grace | 60 | F | + | Wilma | | F | +-------+--------+--------+ (9 rows) - + select * from emp join dept on emp.deptno = dept.deptno; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Bob| 10 | M| 10 | Sales| - | Eric| 20 | M| 20 | Marketing| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| + | Jane | 10 | F | 10 | Sales | + | Bob | 10 | M | 10 | Sales | + | Eric | 20 | M | 20 | Marketing | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | +-------+--------+--------+---------+-------------+ (5 rows) - + select * from emp join dept on emp.deptno = dept.deptno and emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Alice| 30 | F| 30 | Engineering| - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| + | Alice | 30 | F | 30 | Engineering | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | +-------+--------+--------+---------+-------------+ (3 rows) - + select * from emp join dept on emp.deptno = dept.deptno where emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | +-------+--------+--------+---------+-------------+ (3 rows) - + select * from (select * from emp where gender ='F') as emp join dept on emp.deptno = dept.deptno; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | +-------+--------+--------+---------+-------------+ (3 rows) - + select * from emp left join dept on emp.deptno = dept.deptno and emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Adam| 50 | M| |NULL | - | Alice| 30 | F| 30 | Engineering| - | Bob| 10 | M| |NULL | - | Eric| 20 | M| |NULL | - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Wilma| | F| |NULL | + | Adam | 50 | M | |NULL | + | Alice | 30 | F | 30 | Engineering | + | Bob | 10 | M | |NULL | + | Eric | 20 | M | |NULL | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Wilma | | F | |NULL | +-------+--------+--------+---------+-------------+ (9 rows) - + select * from emp left join dept on emp.deptno = dept.deptno where emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Wilma| | F| |NULL | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Wilma | | F | |NULL | +-------+--------+--------+---------+-------------+ (6 rows) - + select * from (select * from emp where gender ='F') as emp left join dept on emp.deptno = dept.deptno; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Wilma| | F| |NULL | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Wilma | | F | |NULL | +-------+--------+--------+---------+-------------+ (6 rows) - + select * from emp right join dept on emp.deptno = dept.deptno and emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Alice| 30 | F| 30 | Engineering| - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - |NULL | |NULL| 20 | Marketing| - |NULL | |NULL| 40 | Empty| + | Alice | 30 | F | 30 | Engineering | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + |NULL | |NULL | 20 | Marketing | + |NULL | |NULL | 40 | Empty | +-------+--------+--------+---------+-------------+ (5 rows) - + select * from emp right join dept on emp.deptno = dept.deptno where emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | +-------+--------+--------+---------+-------------+ (3 rows) - + select * from (select * from emp where gender ='F') as emp right join dept on emp.deptno = dept.deptno; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - |NULL | |NULL| 20 | Marketing| - |NULL | |NULL| 40 | Empty| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + |NULL | |NULL | 20 | Marketing | + |NULL | |NULL | 40 | Empty | +-------+--------+--------+---------+-------------+ (5 rows) - + select * from emp full join dept on emp.deptno = dept.deptno and emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Adam| 50 | M| |NULL | - | Alice| 30 | F| 30 | Engineering| - | Bob| 10 | M| |NULL | - | Eric| 20 | M| |NULL | - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Wilma| | F| |NULL | - |NULL | |NULL| 20 | Marketing| - |NULL | |NULL| 40 | Empty| + | Adam | 50 | M | |NULL | + | Alice | 30 | F | 30 | Engineering | + | Bob | 10 | M | |NULL | + | Eric | 20 | M | |NULL | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Wilma | | F | |NULL | + |NULL | |NULL | 20 | Marketing | + |NULL | |NULL | 40 | Empty | +-------+--------+--------+---------+-------------+ (11 rows) - + select * from emp full join dept on emp.deptno = dept.deptno where emp.gender = 'F'; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Wilma| | F| |NULL | + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Wilma | | F | |NULL | +-------+--------+--------+---------+-------------+ (6 rows) - + select * from (select * from emp where gender ='F') as emp full join dept on emp.deptno = dept.deptno; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Wilma| | F| |NULL | - |NULL | |NULL| 20 | Marketing| - |NULL | |NULL| 40 | Empty| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Wilma | | F | |NULL | + |NULL | |NULL | 20 | Marketing | + |NULL | |NULL | 40 | Empty | +-------+--------+--------+---------+-------------+ (8 rows) - + -- same as above, but expressed as a nestedLoop-join select * from (select * from emp where gender ='F') as emp full join dept on emp.deptno - dept.deptno = 0; +-------+--------+--------+---------+-------------+ | ENAME | DEPTNO | GENDER | DEPTNO0 | DNAME | +-------+--------+--------+---------+-------------+ - | Jane| 10 | F| 10 | Sales| - | Susan| 30 | F| 30 | Engineering| - | Alice| 30 | F| 30 | Engineering| - | Eve| 50 | F| |NULL | - | Grace| 60 | F| |NULL | - | Wilma| | F| |NULL | - |NULL | |NULL| 20 | Marketing| - |NULL | |NULL| 40 | Empty| + | Jane | 10 | F | 10 | Sales | + | Susan | 30 | F | 30 | Engineering | + | Alice | 30 | F | 30 | Engineering | + | Eve | 50 | F | |NULL | + | Grace | 60 | F | |NULL | + | Wilma | | F | |NULL | + |NULL | |NULL | 20 | Marketing | + |NULL | |NULL | 40 | Empty | +-------+--------+--------+---------+-------------+ (8 rows) - + -- [CALCITE-554] Outer join over NULL keys generates wrong result with t1(x) as (select * from (values (1),(2), (case when 1 = 1 then null else 3 end)) as t(x)), t2(x) as (select * from (values (1),(case when 1 = 1 then null else 3 end)) as t(x)) @@ -215,7 +215,7 @@ with t1(x) as (select * from (values (1),(2), (case when 1 = 1 then null else 3 | | +---+ (3 rows) - + -- Equivalent query, using CAST, and skipping unnecessary aliases -- (Postgres doesn't like the missing alias, or the missing parentheses.) with t1(x) as (select * from (values 1, 2, cast(null as integer))), @@ -229,7 +229,7 @@ with t1(x) as (select * from (values 1, 2, cast(null as integer))), | | +---+ (3 rows) - + -- Similar query, projecting left and right key columns with t1(x) as (select * from (values (1), (2), (cast(null as integer))) as t), t2(x) as (select * from (values (1), (cast(null as integer))) as t) @@ -242,7 +242,7 @@ with t1(x) as (select * from (values (1), (2), (cast(null as integer))) as t), | | | +---+---+ (3 rows) - + -- Similar, with 2 columns on each side projecting both columns with t1(x, y) as (select * from (values (1, 10), (2, 20), (cast(null as integer), 30)) as t), t2(x, y) as (select * from (values (1, 100), (cast(null as integer), 200)) as t) @@ -255,7 +255,7 @@ with t1(x, y) as (select * from (values (1, 10), (2, 20), (cast(null as integer) | | 30 | | | +---+----+----+-----+ (3 rows) - + -- Similar, full join with t1(x, y) as (select * from (values (1, 10), (2, 20), (cast(null as integer), 30)) as t), t2(x, y) as (select * from (values (1,100), (cast(null as integer), 200)) as t) @@ -274,7 +274,7 @@ with t1(x, y) as (select * from (values (1, 10), (2, 20), (cast(null as integer) @Test public void testNullableOuter() { // Validated on Postgres - this.q(""" + this.qst(""" with t1(x, y) as (select * from (values (1, 'aa'), (2, 'b'), (null, 'c')) as t), t2(y, x) as (select * from (values ('d', 1), ('b', 2)) as t) select * from t1 full join t2 on t1.x = t2.x and t1.y = t2.y; @@ -282,12 +282,12 @@ with t1(x, y) as (select * from (values (1, 'aa'), (2, 'b'), (null, 'c')) as t), | X | Y | Y | X | +---+---+----+-----+ | 1 | aa|NULL| | - | 2 | b| b| 2 | - | | c|NULL| | - | |NULL| d| 1 | + | 2 | b | b | 2 | + | | c |NULL| | + | |NULL| d | 1 | +---+---+----+-----+ - (4 rows)"""); - this.q(""" + (4 rows) + with t1(x, y, z) as (select * from (values (1, 'aa', 1.0), (2, 'b', 2.0), (null, 'c', 3.0)) as t), t2(y, x, w) as (select * from (values ('d', 1, 1.0), ('b', 2, 2.0)) as t) select * from t1 full join t2 on t1.x = t2.x and t1.y = t2.y; @@ -295,12 +295,12 @@ with t1(x, y, z) as (select * from (values (1, 'aa', 1.0), (2, 'b', 2.0), (null, | X | Y | Z | Y | X | W | +---+---+----+----+-----+----+ | 1 | aa| 1.0|NULL| | | - | 2 | b| 2.0| b| 2 | 2.0| - | | c| 3.0|NULL| | | - | |NULL| | d| 1 | 1.0| + | 2 | b | 2.0| b | 2 | 2.0| + | | c | 3.0|NULL| | | + | |NULL| | d | 1 | 1.0| +---+---+----+-----+----+----+ - (4 rows)"""); - this.q(""" + (4 rows) + with t1(x, y) as (select * from (values (1, 10), (2, 20), (null, 30)) as t), t2(y, x) as (select * from (values (100,1), (20, 2)) as t) select * from t1 full join t2 on t1.x = t2.x and t1.x = t2.y; @@ -313,6 +313,6 @@ with t1(x, y) as (select * from (values (1, 10), (2, 20), (null, 30)) as t), | | | 100| 1 | | | | 20 | 2 | +---+----+----+-----+ - (4 rows)"""); + (5 rows)"""); } } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/PostgresTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/PostgresTests.java index 3cd815b7242..5c86f6d901b 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/PostgresTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/PostgresTests.java @@ -7,7 +7,7 @@ public class PostgresTests extends SqlIoTest { @Test public void testGreatestIgnoreNulls() { - this.qs(""" + this.qst(""" SELECT greatest_ignore_nulls(1, 2, 3) as x; X --- @@ -41,7 +41,7 @@ public void testGreatestIgnoreNulls() { @Test public void testGreatest() { - this.qs(""" + this.qst(""" SELECT greatest(1, 2, 3) as x; X --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/RedshiftTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/RedshiftTests.java index e8c6386322c..0359123f4da 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/RedshiftTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/RedshiftTests.java @@ -7,7 +7,7 @@ public class RedshiftTests extends ScottBaseTests { @Test public void testFirstValue() { - this.qs(""" + this.qst(""" select empno, first_value(sal) over (order by empno range between unbounded preceding and unbounded following) from emp where deptno = 30 order by 1; EMPNO | EXPR$1 @@ -23,7 +23,7 @@ select empno, first_value(sal) over (order by empno range between unbounded prec @Test public void testRank() { - this.qs(""" + this.qst(""" select rank() over (partition by deptno order by sal) from emp; EXPR$0 -------- @@ -46,7 +46,7 @@ public void testRank() { @Test public void testLag() { - this.qs(""" + this.qst(""" select empno, lag(sal) respect nulls over (order by empno) from emp where deptno = 30 order by 1; EMPNO | EXPR$1 @@ -75,7 +75,7 @@ select empno, lag(sal, 2) respect nulls over (order by empno) @Test public void testRegexpReplace() { - this.qs(""" + this.qst(""" select regexp_replace('DonecFri@semperpretiumneque.com', '@.*\\.(org|gov|com)$'); result -------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SelectTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SelectTests.java index 31908ff2aa8..a51a79cf570 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SelectTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SelectTests.java @@ -7,7 +7,7 @@ public class SelectTests extends ScottBaseTests { @Test public void testExclude() { // issue 5216 - this.qs(""" + this.qst(""" select * exclude(empno, ename, job, mgr) from emp order by hiredate limit 1; +------------+--------+------+--------+ | HIREDATE | SAL | COMM | DEPTNO | diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortHrTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortHrTests.java index e5ff02316f5..f5f89b460dd 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortHrTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortHrTests.java @@ -6,15 +6,15 @@ public class SortHrTests extends HrBaseTests { @Test public void testSort() { - this.qs(""" + this.qst(""" select * from "emps" offset 0; +-------+--------+-----------+---------+------------+ | empid | deptno | name | salary | commission | +-------+--------+-----------+---------+------------+ - | 100 | 10 | Bill| 10000.0 | 1000 | - | 110 | 10 | Theodore| 11500.0 | 250 | - | 150 | 10 | Sebastian| 7000.0 | | - | 200 | 20 | Eric| 8000.0 | 500 | + | 100 | 10 | Bill | 10000.0 | 1000 | + | 110 | 10 | Theodore | 11500.0 | 250 | + | 150 | 10 | Sebastian | 7000.0 | | + | 200 | 20 | Eric | 8000.0 | 500 | +-------+--------+-----------+---------+------------+ (4 rows) diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortTests.java index 77d549c733c..9d0a87a1f89 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SortTests.java @@ -5,16 +5,16 @@ /** Tests from Calcite's sort.iq */ public class SortTests extends FoodmartBaseTests { @Test public void testSortOffset() { - this.qs(""" + this.qst(""" select * from dept order by deptno offset 1; +--------+------------+---------+ | DEPTNO | DNAME | LOC | +--------+------------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| - | 40 | OPERATIONS| BOSTON| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | + | 40 | OPERATIONS | BOSTON | +--------+------------+---------+ (3 rows) @@ -24,46 +24,46 @@ public class SortTests extends FoodmartBaseTests { +--------+------------+---------+ | DEPTNO | DNAME | LOC | +--------+------------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| - | 40 | OPERATIONS| BOSTON| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | + | 40 | OPERATIONS | BOSTON | +--------+------------+---------+ (3 rows)"""); } @Test public void testSort() { - this.qs(""" + this.qst(""" select * from "days" order by "day"; +-----+----------+ | day | week_day | - +-----+-------+ - | 1 | Sunday| - | 2 | Monday| - | 3 | Tuesday| + +-----+----------+ + | 1 | Sunday | + | 2 | Monday | + | 3 | Tuesday | | 4 | Wednesday| - | 5 | Thursday| - | 6 | Friday| - | 7 | Saturday| - +-----+-------+ + | 5 | Thursday | + | 6 | Friday | + | 7 | Saturday | + +-----+----------+ (7 rows) select * from "days" order by "day" limit 2; +-----+----------+ | day | week_day | - +-----+-------+ - | 1 | Sunday| - | 2 | Monday| - +-----+-------+ + +-----+----------+ + | 1 | Sunday | + | 2 | Monday | + +-----+----------+ (2 rows) select * from "days" where "day" between 2 and 4 order by "day"; +-----+-----------+ | day | week_day | +-----+-----------+ - | 2 | Monday| - | 3 | Tuesday| - | 4 | Wednesday| + | 2 | Monday | + | 3 | Tuesday | + | 4 | Wednesday | +-----+-----------+ (3 rows) @@ -121,10 +121,10 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 40 | OPERATIONS| BOSTON| - | 30 | SALES| CHICAGO| - | 20 | RESEARCH| DALLAS| - | 10 | ACCOUNTING| NEW YORK| + | 40 | OPERATIONS | BOSTON | + | 30 | SALES | CHICAGO | + | 20 | RESEARCH | DALLAS | + | 10 | ACCOUNTING | NEW YORK | +--------+------------+----------+ (4 rows) @@ -134,8 +134,8 @@ public void testSort() { +--------+----------+---------+ | DEPTNO | DNAME | LOC | +--------+----------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | +--------+----------+---------+ (2 rows) @@ -145,8 +145,8 @@ public void testSort() { +--------+----------+---------+ | DEPTNO | DNAME | LOC | +--------+----------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | +--------+----------+---------+ (2 rows) @@ -156,8 +156,8 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 10 | ACCOUNTING| NEW YORK| - | 20 | RESEARCH| DALLAS| + | 10 | ACCOUNTING | NEW YORK | + | 20 | RESEARCH | DALLAS | +--------+------------+----------+ (2 rows) @@ -167,8 +167,8 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 10 | ACCOUNTING| NEW YORK| - | 20 | RESEARCH| DALLAS| + | 10 | ACCOUNTING | NEW YORK | + | 20 | RESEARCH | DALLAS | +--------+------------+----------+ (2 rows) @@ -178,10 +178,10 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 10 | ACCOUNTING| NEW YORK| - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| - | 40 | OPERATIONS| BOSTON| + | 10 | ACCOUNTING | NEW YORK | + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | + | 40 | OPERATIONS | BOSTON | +--------+------------+----------+ (4 rows) @@ -191,8 +191,8 @@ public void testSort() { +--------+----------+---------+ | DEPTNO | DNAME | LOC | +--------+----------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | +--------+----------+---------+ (2 rows) @@ -202,8 +202,8 @@ public void testSort() { +--------+----------+---------+ | DEPTNO | DNAME | LOC | +--------+----------+---------+ - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | +--------+----------+---------+ (2 rows) @@ -213,8 +213,8 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 10 | ACCOUNTING| NEW YORK| - | 20 | RESEARCH| DALLAS| + | 10 | ACCOUNTING | NEW YORK | + | 20 | RESEARCH | DALLAS | +--------+------------+----------+ (2 rows) @@ -224,10 +224,10 @@ public void testSort() { +--------+------------+----------+ | DEPTNO | DNAME | LOC | +--------+------------+----------+ - | 10 | ACCOUNTING| NEW YORK| - | 20 | RESEARCH| DALLAS| - | 30 | SALES| CHICAGO| - | 40 | OPERATIONS| BOSTON| + | 10 | ACCOUNTING | NEW YORK | + | 20 | RESEARCH | DALLAS | + | 30 | SALES | CHICAGO | + | 40 | OPERATIONS | BOSTON | +--------+------------+----------+ (4 rows) """); diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StreamTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StreamTests.java index 3945afe5a34..b343987ba71 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StreamTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StreamTests.java @@ -38,7 +38,7 @@ public void testNegativeTumble() { @Test public void testTumble() { - this.qs(""" + this.qst(""" SELECT * FROM TABLE( TUMBLE( DATA => TABLE ORDERS, @@ -47,11 +47,11 @@ public void testTumble() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (5 rows) @@ -59,11 +59,11 @@ public void testTumble() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (5 rows) @@ -71,11 +71,11 @@ public void testTumble() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:16:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:24:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:58:00.000 | 2015-02-15 10:59:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:11:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (5 rows) @@ -83,32 +83,32 @@ public void testTumble() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:13:00.000 | 2015-02-15 10:23:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:53:00.000 | 2015-02-15 11:03:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:03:00.000 | 2015-02-15 11:13:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:13:00.000 | 2015-02-15 10:23:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:23:00.000 | 2015-02-15 10:33:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:53:00.000 | 2015-02-15 11:03:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:03:00.000 | 2015-02-15 11:13:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (5 rows)"""); } @Test public void testHop() { - this.qs(""" + this.qst(""" SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '5' MINUTE, INTERVAL '10' MINUTE)); +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (10 rows) @@ -121,16 +121,16 @@ public void testHop() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (10 rows) @@ -138,37 +138,37 @@ public void testHop() { +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:10:00.000 | 2015-02-15 10:20:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:15:00.000 | 2015-02-15 10:25:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:20:00.000 | 2015-02-15 10:30:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:50:00.000 | 2015-02-15 11:00:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:55:00.000 | 2015-02-15 11:05:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:05:00.000 | 2015-02-15 11:15:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:10:00.000 | 2015-02-15 11:20:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (10 rows)"""); } @Test public void testHop4() { - this.qs(""" + this.qst(""" SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '5' MINUTE, INTERVAL '10' MINUTE, INTERVAL '2' MINUTE)); +---------------------+----+---------+-------+-------------------------+-------------------------+ | ROWTIME | ID | PRODUCT | UNITS | window_start | window_end | +---------------------+----+---------+-------+-------------------------+-------------------------+ - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:07:00.000 | 2015-02-15 10:17:00.000 | - | 2015-02-15 10:15:00 | 1 | paint| 10 | 2015-02-15 10:12:00.000 | 2015-02-15 10:22:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 | - | 2015-02-15 10:24:15 | 2 | paper| 5 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 | - | 2015-02-15 10:24:45 | 3 | brush| 12 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:52:00.000 | 2015-02-15 11:02:00.000 | - | 2015-02-15 10:58:00 | 4 | paint| 3 | 2015-02-15 10:57:00.000 | 2015-02-15 11:07:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:02:00.000 | 2015-02-15 11:12:00.000 | - | 2015-02-15 11:10:00 | 5 | paint| 3 | 2015-02-15 11:07:00.000 | 2015-02-15 11:17:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:07:00.000 | 2015-02-15 10:17:00.000 | + | 2015-02-15 10:15:00 | 1 | paint | 10 | 2015-02-15 10:12:00.000 | 2015-02-15 10:22:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 | + | 2015-02-15 10:24:15 | 2 | paper | 5 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:17:00.000 | 2015-02-15 10:27:00.000 | + | 2015-02-15 10:24:45 | 3 | brush | 12 | 2015-02-15 10:22:00.000 | 2015-02-15 10:32:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:52:00.000 | 2015-02-15 11:02:00.000 | + | 2015-02-15 10:58:00 | 4 | paint | 3 | 2015-02-15 10:57:00.000 | 2015-02-15 11:07:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:02:00.000 | 2015-02-15 11:12:00.000 | + | 2015-02-15 11:10:00 | 5 | paint | 3 | 2015-02-15 11:07:00.000 | 2015-02-15 11:17:00.000 | +---------------------+----+---------+-------+-------------------------+-------------------------+ (10 rows)"""); } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StructTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StructTests.java index 2d1d5b70ae7..3512eb0cc8d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StructTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/StructTests.java @@ -6,7 +6,7 @@ public class StructTests extends ScottBaseTests { @Test public void isNullRow() { - this.qs(""" + this.qst(""" SELECT ROW(NULL) IS NULL; r --- @@ -16,7 +16,7 @@ public void isNullRow() { @Test public void testRow() { - this.qs(""" + this.qst(""" -- struct.iq - Queries involving structured types -- [CALCITE-2677] Struct types with one field are not mapped correctly to Java Classes select * from (values @@ -87,10 +87,10 @@ public void testRow() { +--------+----------+---+ | DEPTNO | JOB | X | +--------+----------+---+ - | 20 | CLERK| 1 | - | 20 | MANAGER| 3 | - | 30 | SALESMAN| 2 | - | 30 | SALESMAN| 2 | + | 20 | CLERK | 1 | + | 20 | MANAGER | 3 | + | 30 | SALESMAN | 2 | + | 30 | SALESMAN | 2 | +--------+----------+---+ (4 rows) @@ -106,10 +106,10 @@ public void testRow() { +--------+----------+---+ | DEPTNO | JOB | X | +--------+----------+---+ - | 20 | CLERK| 1 | - | 20 | MANAGER| 3 | - | 30 | SALESMAN| 2 | - | 30 | SALESMAN| 2 | + | 20 | CLERK | 1 | + | 20 | MANAGER | 3 | + | 30 | SALESMAN | 2 | + | 30 | SALESMAN | 2 | +--------+----------+---+ (4 rows) diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SubQueryTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SubQueryTests.java index 823c1a60e33..1a79006985f 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SubQueryTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/SubQueryTests.java @@ -6,7 +6,7 @@ public class SubQueryTests extends ScottBaseTests { @Test public void wellKnownCountBug() { - this.qs(""" + this.qst(""" SELECT * from emp as e where exists ( @@ -17,20 +17,20 @@ where exists ( +-------+--------+-----------+------+------------+---------+---------+--------+ | EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DEPTNO | +-------+--------+-----------+------+------------+---------+---------+--------+ - | 7369 | SMITH| CLERK| 7902 | 1980-12-17 | 800.00 | | 20 | - | 7499 | ALLEN| SALESMAN| 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 | - | 7521 | WARD| SALESMAN| 7698 | 1981-02-22 | 1250.00 | 500.00 | 30 | - | 7566 | JONES| MANAGER| 7839 | 1981-02-04 | 2975.00 | | 20 | - | 7654 | MARTIN| SALESMAN| 7698 | 1981-09-28 | 1250.00 | 1400.00 | 30 | - | 7698 | BLAKE| MANAGER| 7839 | 1981-01-05 | 2850.00 | | 30 | - | 7782 | CLARK| MANAGER| 7839 | 1981-06-09 | 2450.00 | | 10 | - | 7788 | SCOTT| ANALYST| 7566 | 1987-04-19 | 3000.00 | | 20 | - | 7839 | KING| PRESIDENT| | 1981-11-17 | 5000.00 | | 10 | - | 7844 | TURNER| SALESMAN| 7698 | 1981-09-08 | 1500.00 | 0.00 | 30 | - | 7876 | ADAMS| CLERK| 7788 | 1987-05-23 | 1100.00 | | 20 | - | 7900 | JAMES| CLERK| 7698 | 1981-12-03 | 950.00 | | 30 | - | 7902 | FORD| ANALYST| 7566 | 1981-12-03 | 3000.00 | | 20 | - | 7934 | MILLER| CLERK| 7782 | 1982-01-23 | 1300.00 | | 10 | + | 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | | 20 | + | 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 | + | 7521 | WARD | SALESMAN | 7698 | 1981-02-22 | 1250.00 | 500.00 | 30 | + | 7566 | JONES | MANAGER | 7839 | 1981-02-04 | 2975.00 | | 20 | + | 7654 | MARTIN | SALESMAN | 7698 | 1981-09-28 | 1250.00 | 1400.00 | 30 | + | 7698 | BLAKE | MANAGER | 7839 | 1981-01-05 | 2850.00 | | 30 | + | 7782 | CLARK | MANAGER | 7839 | 1981-06-09 | 2450.00 | | 10 | + | 7788 | SCOTT | ANALYST | 7566 | 1987-04-19 | 3000.00 | | 20 | + | 7839 | KING | PRESIDENT | | 1981-11-17 | 5000.00 | | 10 | + | 7844 | TURNER | SALESMAN | 7698 | 1981-09-08 | 1500.00 | 0.00 | 30 | + | 7876 | ADAMS | CLERK | 7788 | 1987-05-23 | 1100.00 | | 20 | + | 7900 | JAMES | CLERK | 7698 | 1981-12-03 | 950.00 | | 30 | + | 7902 | FORD | ANALYST | 7566 | 1981-12-03 | 3000.00 | | 20 | + | 7934 | MILLER | CLERK | 7782 | 1982-01-23 | 1300.00 | | 10 | +-------+--------+-----------+------+------------+---------+---------+--------+ (14 rows) @@ -102,7 +102,7 @@ inner join ( @Test public void testOrderByLimit() { // Validated using MySQL - this.qs(""" + this.qst(""" SELECT comm AS comm FROM EMP where 30 = EMP.deptno ORDER BY comm limit 1; @@ -128,14 +128,14 @@ public void testOrderByLimit() { public void firstValueTests() { // All these produce calls to FIRST_VALUE from the expansion // Modified and tested on MySQL, since Calcite treats NULLs differently. - this.qs(""" + this.qst(""" SELECT dname FROM DEPT WHERE 2000 > (SELECT EMP.sal FROM EMP where DEPT.deptno = EMP.deptno ORDER BY year(hiredate), EMP.sal limit 1); +----------+ | DNAME | +----------+ - | RESEARCH| - | SALES| + | RESEARCH | + | SALES | +----------+ (2 rows) @@ -158,10 +158,10 @@ public void firstValueTests() { +------------+--------+ | DNAME | EXPR$1 | +------------+--------+ - | ACCOUNTING| | - | OPERATIONS| | - | RESEARCH| | - | SALES| 1400 | + | ACCOUNTING | | + | OPERATIONS | | + | RESEARCH | | + | SALES | 1400 | +------------+--------+ (4 rows) @@ -173,10 +173,10 @@ ORDER BY year(hiredate), EMP.sal limit 1) +------------+---------+ | DNAME | EXPR$1 | +------------+---------+ - | ACCOUNTING| 2450.00 | - | OPERATIONS| | - | RESEARCH| 800.00 | - | SALES| 950.00 | + | ACCOUNTING | 2450.00 | + | OPERATIONS | | + | RESEARCH | 800.00 | + | SALES | 950.00 | +------------+---------+ (4 rows) @@ -188,17 +188,17 @@ ORDER BY year(hiredate), EMP.sal limit 1) +------------+--------+ | DNAME | EXPR$1 | +------------+--------+ - | ACCOUNTING| | - | OPERATIONS| | - | RESEARCH| | - | SALES| | + | ACCOUNTING | | + | OPERATIONS | | + | RESEARCH | | + | SALES | | +------------+--------+ (4 rows)"""); } @Test @Ignore("Cannot be decorrelated") public void testFirst1() { - this.qs(""" + this.qst(""" select sal from EMP e where mod(cast(rand() as int), 2) = 3 OR 123 IN ( select cast(null as int) diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggPostTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggPostTests.java index c5ef092549a..946255675ea 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggPostTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggPostTests.java @@ -7,7 +7,7 @@ public class WinAggPostTests extends PostBaseTests { @Test @Ignore("ORDER BY strings not supported https://github.com/feldera/feldera/issues/457") public void test() { - this.qs(""" + this.qst(""" select deptno, ename, mode(gender) over (partition by deptno order by ENAME) as m @@ -148,19 +148,19 @@ select deptno, gender, min(ename) as x, sum(deptno) as y, public void test0() { // Constant argument to aggregate, issue 4010 // validated on Postgres - this.qs(""" + this.qst(""" select *, first_value(ename) over (partition by deptno order by gender range unbounded preceding) from emp; ename | deptno | gender | first_value -------+--------+--------+------------- - Jane| 10 | F| Jane - Bob| 10 | M| Jane - Eric| 20 | M| Eric - Alice| 30 | F| Alice - Susan| 30 | F| Alice - Eve| 50 | F| Eve - Adam| 50 | M| Eve - Grace| 60 | F| Grace - Wilma| | F| Wilma + Jane | 10 | F | Jane + Bob | 10 | M | Jane + Eric | 20 | M | Eric + Alice | 30 | F | Alice + Susan | 30 | F | Alice + Eve | 50 | F | Eve + Adam | 50 | M | Eve + Grace | 60 | F | Grace + Wilma | | F | Wilma (9 rows) select gender,deptno, @@ -169,18 +169,18 @@ public void test0() { +--------+--------+--------+ | gender | deptno | count1 | +--------+--------+--------+ - | F| 10 | 1 | - | F| 30 | 2 | - | F| 30 | 2 | - | F| 50 | 1 | - | F| 60 | 1 | - | F| | 1 | - | M| 10 | 1 | - | M| 20 | 1 | - | M| 50 | 1 | + | F | 10 | 1 | + | F | 30 | 2 | + | F | 30 | 2 | + | F | 50 | 1 | + | F | 60 | 1 | + | F | | 1 | + | M | 10 | 1 | + | M | 20 | 1 | + | M | 50 | 1 | +--------+--------+--------+ (9 rows)"""); - this.qs(""" + this.qst(""" -- [CALCITE-1540] Support multiple columns in PARTITION BY clause of window function select gender,deptno, count(*) over (partition by gender,deptno) as count1 @@ -188,15 +188,15 @@ public void test0() { +--------+--------+--------+ | GENDER | DEPTNO | COUNT1 | +--------+--------+--------+ - | F| 10 | 1 | - | F| 30 | 2 | - | F| 30 | 2 | - | F| 50 | 1 | - | F| 60 | 1 | - | F| | 1 | - | M| 10 | 1 | - | M| 20 | 1 | - | M| 50 | 1 | + | F | 10 | 1 | + | F | 30 | 2 | + | F | 30 | 2 | + | F | 50 | 1 | + | F | 60 | 1 | + | F | | 1 | + | M | 10 | 1 | + | M | 20 | 1 | + | M | 50 | 1 | +--------+--------+--------+ (9 rows) @@ -208,15 +208,15 @@ public void test0() { +--------+--------+--------+ | GENDER | DEPTNO | COUNT1 | +--------+--------+--------+ - | F| 10 | 6 | - | F| 30 | 6 | - | F| 30 | 6 | - | F| 50 | 6 | - | F| 60 | 6 | - | F| | 6 | - | M| 10 | 3 | - | M| 20 | 3 | - | M| 50 | 3 | + | F | 10 | 6 | + | F | 30 | 6 | + | F | 30 | 6 | + | F | 50 | 6 | + | F | 60 | 6 | + | F | | 6 | + | M | 10 | 3 | + | M | 20 | 3 | + | M | 50 | 3 | +--------+--------+--------+ (9 rows)"""); } @@ -227,53 +227,53 @@ public void test2() { // deterministic in our implementation, but they give a different result // than other SQL dialects. // Here the sorting is implicit on ename, deptno, gender - this.qs(""" + this.qst(""" select *, first_value(deptno) over () from emp; ename | deptno | gender | first_value -------+--------+--------+------------- - Jane| 10 | F| 50 - Bob| 10 | M| 50 - Eric| 20 | M| 50 - Susan| 30 | F| 50 - Alice| 30 | F| 50 - Adam| 50 | M| 50 - Eve| 50 | F| 50 - Grace| 60 | F| 50 - Wilma| | F| 50 + Jane | 10 | F | 50 + Bob | 10 | M | 50 + Eric | 20 | M | 50 + Susan | 30 | F | 50 + Alice | 30 | F | 50 + Adam | 50 | M | 50 + Eve | 50 | F | 50 + Grace | 60 | F | 50 + Wilma | | F | 50 (9 rows)"""); - this.qs(""" + this.qst(""" select *, first_value(ename) over () from emp; ename | deptno | gender | first_value -------+--------+--------+------------- - Jane| 10 | F| Adam - Bob| 10 | M| Adam - Eric| 20 | M| Adam - Susan| 30 | F| Adam - Alice| 30 | F| Adam - Adam| 50 | M| Adam - Eve| 50 | F| Adam - Grace| 60 | F| Adam - Wilma| | F| Adam + Jane | 10 | F | Adam + Bob | 10 | M | Adam + Eric | 20 | M | Adam + Susan | 30 | F | Adam + Alice | 30 | F | Adam + Adam | 50 | M | Adam + Eve | 50 | F | Adam + Grace | 60 | F | Adam + Wilma | | F | Adam (9 rows) select *, first_value(ename) over (partition by deptno) from emp; ename | deptno | gender | first_value -------+--------+--------+------------- - Jane| 10 | F| Bob - Bob| 10 | M| Bob - Eric| 20 | M| Eric - Susan| 30 | F| Alice - Alice| 30 | F| Alice - Adam| 50 | M| Adam - Eve| 50 | F| Adam - Grace| 60 | F| Grace - Wilma| | F| Wilma + Jane | 10 | F | Bob + Bob | 10 | M | Bob + Eric | 20 | M | Eric + Susan | 30 | F | Alice + Alice | 30 | F | Alice + Adam | 50 | M | Adam + Eve | 50 | F | Adam + Grace | 60 | F | Grace + Wilma | | F | Wilma (9 rows)"""); } @Test public void test3() { - this.qs(""" + this.qst(""" -- No ORDER BY, windows defined in WINDOW clause. select deptno, gender, min(gender) over w1 as a, min(gender) over w2 as d from emp @@ -282,15 +282,15 @@ window w1 as (), +--------+--------+---+---+ | DEPTNO | GENDER | A | D | +--------+--------+---+---+ - | 10 | F| F| F| - | 10 | M| F| F| - | 20 | M| F| M| - | 30 | F| F| F| - | 30 | F| F| F| - | 50 | F| F| F| - | 50 | M| F| F| - | 60 | F| F| F| - | | F| F| F| + | 10 | F | F | F | + | 10 | M | F | F | + | 20 | M | F | M | + | 30 | F | F | F | + | 30 | F | F | F | + | 50 | F | F | F | + | 50 | M | F | F | + | 60 | F | F | F | + | | F | F | F | +--------+--------+---+---+ (9 rows) @@ -299,15 +299,15 @@ window w1 as (), +-------+--------+--------+---+ | ENAME | DEPTNO | GENDER | C | +-------+--------+--------+---+ - | Adam| 50 | M| 2 | - | Alice| 30 | F| 2 | - | Bob| 10 | M| 2 | - | Eric| 20 | M| 1 | - | Eve| 50 | F| 2 | - | Grace| 60 | F| 1 | - | Jane| 10 | F| 2 | - | Susan| 30 | F| 2 | - | Wilma| | F| 1 | + | Adam | 50 | M | 2 | + | Alice | 30 | F | 2 | + | Bob | 10 | M | 2 | + | Eric | 20 | M | 1 | + | Eve | 50 | F | 2 | + | Grace | 60 | F | 1 | + | Jane | 10 | F | 2 | + | Susan | 30 | F | 2 | + | Wilma | | F | 1 | +-------+--------+--------+---+ (9 rows) @@ -318,22 +318,22 @@ select deptno, gender, count(gender, deptno) over w1 as a +--------+--------+---+ | DEPTNO | GENDER | A | +--------+--------+---+ - | 10 | F| 8 | - | 10 | M| 8 | - | 20 | M| 8 | - | 30 | F| 8 | - | 30 | F| 8 | - | 50 | F| 8 | - | 50 | M| 8 | - | 60 | F| 8 | - | | F| 8 | + | 10 | F | 8 | + | 10 | M | 8 | + | 20 | M | 8 | + | 30 | F | 8 | + | 30 | F | 8 | + | 50 | F | 8 | + | 50 | M | 8 | + | 60 | F | 8 | + | | F | 8 | +--------+--------+---+ (9 rows)"""); } @Test @Ignore("unsupported aggregate functions") public void test4() { - this.qs(""" + this.qst(""" -- NTH_VALUE select emp."ENAME", emp."DEPTNO", nth_value(emp."DEPTNO", 1) over() as "first_value", @@ -345,15 +345,15 @@ public void test4() { +-------+--------+-------------+--------------+-------------+--------------+-------------+ | ENAME | DEPTNO | first_value | second_value | fifth_value | eighth_value | tenth_value | +-------+--------+-------------+--------------+-------------+--------------+-------------+ - | Adam| 50 | 10 | 10 | 30 | 60 | | - | Alice| 30 | 10 | 10 | 30 | 60 | | - | Bob| 10 | 10 | 10 | 30 | 60 | | - | Eric| 20 | 10 | 10 | 30 | 60 | | - | Eve| 50 | 10 | 10 | 30 | 60 | | - | Grace| 60 | 10 | 10 | 30 | 60 | | - | Jane| 10 | 10 | 10 | 30 | 60 | | - | Susan| 30 | 10 | 10 | 30 | 60 | | - | Wilma| | 10 | 10 | 30 | 60 | | + | Adam | 50 | 10 | 10 | 30 | 60 | | + | Alice | 30 | 10 | 10 | 30 | 60 | | + | Bob | 10 | 10 | 10 | 30 | 60 | | + | Eric | 20 | 10 | 10 | 30 | 60 | | + | Eve | 50 | 10 | 10 | 30 | 60 | | + | Grace | 60 | 10 | 10 | 30 | 60 | | + | Jane | 10 | 10 | 10 | 30 | 60 | | + | Susan | 30 | 10 | 10 | 30 | 60 | | + | Wilma | | 10 | 10 | 30 | 60 | | +-------+--------+-------------+--------------+-------------+--------------+-------------+ (9 rows) @@ -502,38 +502,38 @@ public void test4() { @Test public void testWindows1() { // Adjusted and validated using MySQL - this.qs(""" + this.qst(""" select *, count(*) over (order by deptno) as c from emp; ENAME | DEPTNO | GENDER | C -------+--------+--------+--- - Jane| 10 | F| 3 - Bob| 10 | M| 3 - Eric| 20 | M| 4 - Susan| 30 | F| 6 - Alice| 30 | F| 6 - Adam| 50 | M| 8 - Eve| 50 | F| 8 - Grace| 60 | F| 9 - Wilma| | F| 1 + Jane | 10 | F | 3 + Bob | 10 | M | 3 + Eric | 20 | M | 4 + Susan | 30 | F | 6 + Alice | 30 | F | 6 + Adam | 50 | M | 8 + Eve | 50 | F | 8 + Grace | 60 | F | 9 + Wilma | | F | 1 (9 rows)"""); } @Test public void testRank() { - this.qs(""" + this.qst(""" select *, rank() over (order by deptno NULLS LAST) as c from emp; +-------+--------+--------+---+ | ENAME | DEPTNO | GENDER | C | +-------+--------+--------+---+ - | Adam| 50 | M| 6 | - | Alice| 30 | F| 4 | - | Bob| 10 | M| 1 | - | Eric| 20 | M| 3 | - | Eve| 50 | F| 6 | - | Grace| 60 | F| 8 | - | Jane| 10 | F| 1 | - | Susan| 30 | F| 4 | - | Wilma| | F| 9 | + | Adam | 50 | M | 6 | + | Alice | 30 | F | 4 | + | Bob | 10 | M | 1 | + | Eric | 20 | M | 3 | + | Eve | 50 | F | 6 | + | Grace | 60 | F | 8 | + | Jane | 10 | F | 1 | + | Susan | 30 | F | 4 | + | Wilma | | F | 9 | +-------+--------+--------+---+ (9 rows) @@ -542,15 +542,15 @@ public void testRank() { +-------+--------+--------+---+ | ENAME | DEPTNO | GENDER | C | +-------+--------+--------+---+ - | Adam| 50 | M| 4 | - | Alice| 30 | F| 3 | - | Bob| 10 | M| 1 | - | Eric| 20 | M| 2 | - | Eve| 50 | F| 4 | - | Grace| 60 | F| 5 | - | Jane| 10 | F| 1 | - | Susan| 30 | F| 3 | - | Wilma| | F| 6 | + | Adam | 50 | M | 4 | + | Alice | 30 | F | 3 | + | Bob | 10 | M | 1 | + | Eric | 20 | M | 2 | + | Eve | 50 | F | 4 | + | Grace | 60 | F | 5 | + | Jane | 10 | F | 1 | + | Susan | 30 | F | 3 | + | Wilma | | F | 6 | +-------+--------+--------+---+ (9 rows)"""); } @@ -558,7 +558,7 @@ public void testRank() { @Test public void testRowDifferentPartitions() { // Validated on Postgres by making the query deterministic - this.qs(""" + this.qst(""" select *, row_number() over (order by deptno /*, ename, gender */) as r1, row_number() over (partition by deptno order by gender desc /*, ename */) as r2 @@ -566,15 +566,15 @@ public void testRowDifferentPartitions() { +-------+--------+--------+----+----+ | ENAME | DEPTNO | GENDER | R1 | R2 | +-------+--------+--------+----+----+ - | Wilma| | F| 1 | 1 | - | Bob| 10 | M| 2 | 1 | - | Jane| 10 | F| 3 | 2 | - | Eric| 20 | M| 4 | 1 | - | Alice| 30 | F| 5 | 1 | - | Susan| 30 | F| 6 | 2 | - | Adam| 50 | M| 7 | 1 | - | Eve| 50 | F| 8 | 2 | - | Grace| 60 | F| 9 | 1 | + | Wilma | | F | 1 | 1 | + | Bob | 10 | M | 2 | 1 | + | Jane | 10 | F | 3 | 2 | + | Eric | 20 | M | 4 | 1 | + | Alice | 30 | F | 5 | 1 | + | Susan | 30 | F | 6 | 2 | + | Adam | 50 | M | 7 | 1 | + | Eve | 50 | F | 8 | 2 | + | Grace | 60 | F | 9 | 1 | +-------+--------+--------+----+----+ (9 rows)"""); } @@ -585,7 +585,7 @@ public void testWindows2() { // Had to adjust results, since sorting is deterministic in Feldera. // Validated on Postgres by making the query deterministic by uncommenting // the commented-out sort helpers - this.qs(""" + this.qst(""" -- [CALCITE-806] ROW_NUMBER should emit distinct values select *, row_number() over (order by deptno /* nulls first, ename, gender */) as r1, @@ -597,15 +597,15 @@ public void testWindows2() { +-------+--------+--------+----+----+----+----+---+ | ENAME | DEPTNO | GENDER | R1 | R2 | R3 | R4 | R | +-------+--------+--------+----+----+----+----+---+ - | Wilma| | F| 1 | 1 | 1 | 6 | 9 | - | Bob| 10 | M| 2 | 1 | 2 | 2 | 3 | - | Jane| 10 | F| 3 | 2 | 1 | 4 | 7 | - | Eric| 20 | M| 4 | 1 | 1 | 3 | 4 | - | Alice| 30 | F| 5 | 1 | 1 | 1 | 2 | - | Susan| 30 | F| 6 | 2 | 2 | 5 | 8 | - | Adam| 50 | M| 7 | 1 | 2 | 1 | 1 | - | Eve| 50 | F| 8 | 2 | 1 | 2 | 5 | - | Grace| 60 | F| 9 | 1 | 1 | 3 | 6 | + | Wilma | | F | 1 | 1 | 1 | 6 | 9 | + | Bob | 10 | M | 2 | 1 | 2 | 2 | 3 | + | Jane | 10 | F | 3 | 2 | 1 | 4 | 7 | + | Eric | 20 | M | 4 | 1 | 1 | 3 | 4 | + | Alice | 30 | F | 5 | 1 | 1 | 1 | 2 | + | Susan | 30 | F | 6 | 2 | 2 | 5 | 8 | + | Adam | 50 | M | 7 | 1 | 2 | 1 | 1 | + | Eve | 50 | F | 8 | 2 | 1 | 2 | 5 | + | Grace | 60 | F | 9 | 1 | 1 | 3 | 6 | +-------+--------+--------+----+----+----+----+---+ (9 rows) @@ -619,19 +619,19 @@ public void testWindows2() { +--------+-------+---+ | DEPTNO | ENAME | R | +--------+-------+---+ - | 10 | Jane| 1 | - | 30 | Alice| 1 | - | 30 | Susan| 2 | - | 50 | Eve| 1 | - | 60 | Grace| 1 | - | | Wilma| 1 | + | 10 | Jane | 1 | + | 30 | Alice | 1 | + | 30 | Susan | 2 | + | 50 | Eve | 1 | + | 60 | Grace | 1 | + | | Wilma | 1 | +--------+-------+---+ (6 rows)"""); } @Test public void testWindows3() { - this.qs(""" + this.qst(""" -- [CALCITE-2271] Two windows under a JOIN 2 select t1.l, t1.key as key1, t2.key as key2 @@ -665,7 +665,7 @@ public void testWindows3() { @Test public void testCountIf() { - this.qs(""" + this.qst(""" -- COUNTIF(b) (BigQuery) is equivalent to COUNT(*) FILTER (WHERE b) select deptno, countif(gender = 'F') as f from emp @@ -703,7 +703,7 @@ select countif(a > 0) + countif(a > 1) + countif(c > 1) as c @Test public void testGrouping3() { - this.qs(""" + this.qst(""" -- [CALCITE-4665] Allow Aggregate.groupKey to be a strict superset of -- Aggregate.groupKeys -- Use a condition on grouping_id to filter out the superset grouping sets. @@ -718,15 +718,15 @@ having grouping_id(ename, deptno, gender) <> 0 +-------+--------+--------+-----+-----+-----+ | ENAME | DEPTNO | GENDER | G_E | G_D | G_G | +-------+--------+--------+-----+-----+-----+ - | Adam| 50 |NULL| 0 | 0 | 1 | - | Adam| |NULL| 0 | 1 | 1 | - | Bob| 10 |NULL| 0 | 0 | 1 | - | Bob| |NULL| 0 | 1 | 1 | - | Eric| 20 |NULL| 0 | 0 | 1 | - | Eric| |NULL| 0 | 1 | 1 | - |NULL| 10 |NULL| 1 | 0 | 1 | - |NULL| 20 |NULL| 1 | 0 | 1 | - |NULL| 50 |NULL| 1 | 0 | 1 | + | Adam | 50 |NULL | 0 | 0 | 1 | + | Adam | |NULL | 0 | 1 | 1 | + | Bob | 10 |NULL | 0 | 0 | 1 | + | Bob | |NULL | 0 | 1 | 1 | + | Eric | 20 |NULL | 0 | 0 | 1 | + | Eric | |NULL | 0 | 1 | 1 | + |NULL | 10 |NULL | 1 | 0 | 1 | + |NULL | 20 |NULL | 1 | 0 | 1 | + |NULL | 50 |NULL | 1 | 0 | 1 | +-------+--------+--------+-----+-----+-----+ (9 rows) @@ -740,15 +740,15 @@ group by grouping sets (ename, deptno, (ename, deptno)) +-------+--------+-----+-----+ | ENAME | DEPTNO | G_E | G_D | +-------+--------+-----+-----+ - | Adam| 50 | 0 | 0 | - | Adam| | 0 | 1 | - | Bob| 10 | 0 | 0 | - | Bob| | 0 | 1 | - | Eric| 20 | 0 | 0 | - | Eric| | 0 | 1 | - |NULL| 10 | 1 | 0 | - |NULL| 20 | 1 | 0 | - |NULL| 50 | 1 | 0 | + | Adam | 50 | 0 | 0 | + | Adam | | 0 | 1 | + | Bob | 10 | 0 | 0 | + | Bob | | 0 | 1 | + | Eric | 20 | 0 | 0 | + | Eric | | 0 | 1 | + |NULL | 10 | 1 | 0 | + |NULL | 20 | 1 | 0 | + |NULL | 50 | 1 | 0 | +-------+--------+-----+-----+ (9 rows) diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggTests.java index 6cdb64d404e..d6dd7bd0dbd 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/quidem/WinAggTests.java @@ -7,7 +7,7 @@ public class WinAggTests extends ScottBaseTests { @Test public void testWindows0() { - this.qs(""" + this.qst(""" select empno, deptno, count(*) over (order by deptno) c1, count(*) over (order by deptno range unbounded preceding) c2, @@ -37,7 +37,7 @@ public void testWindows0() { @Test @Ignore("ROWS not yet implemented in WINDOW https://github.com/feldera/feldera/issues/457") public void testWindows() { - this.qs(""" + this.qst(""" -- Check default brackets. Note that: -- c2 and c3 are equivalent to c1; -- c5 is equivalent to c4; diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/AggregateTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/AggregateTests.java index 4bb2e738dcd..3d1d757c7de 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/AggregateTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/AggregateTests.java @@ -54,7 +54,7 @@ CREATE TABLE NN ( @Test public void issue2042() { - this.qs(""" + this.qst(""" SELECT ARG_MAX(I, I), ARG_MAX(I, J), ARG_MAX(J, I), ARG_MAX(J, J) FROM NN; ii | ij | ji | jj @@ -89,7 +89,7 @@ SELECT K, ARG_MIN(I, I), ARG_MIN(I, J), ARG_MIN(J, I), ARG_MIN(J, J) @Test public void testIssue1957() { // validated using Postgres - this.qs(""" + this.qst(""" SELECT id, (SELECT ARRAY_AGG(id) FROM ( @@ -111,7 +111,7 @@ public void testIssue1957() { @Test public void issue4777() { // validated using Postgres, but second result is not deterministic - this.qs(""" + this.qst(""" SELECT ARRAY_AGG(parentId ORDER BY id) FROM warehouse; array @@ -207,7 +207,7 @@ FROM TABLE( @Test public void testArrayConstructor() { - this.qs(""" + this.qst(""" SELECT id, (SELECT ARRAY( @@ -225,7 +225,7 @@ public void testArrayConstructor() { 30 | { 3, 5, 20 } (6 rows)"""); - this.qs(""" + this.qst(""" SELECT id, (SELECT ARRAY( @@ -247,7 +247,7 @@ public void testArrayConstructor() { @Test public void testOneArgMin() { - this.qs(""" + this.qst(""" SELECT ARG_MIN(V, B) FROM T; B @@ -296,13 +296,13 @@ public void endVisit() { @Test public void testArgMin() { - this.qs(""" + this.qst(""" SELECT ARG_MIN(V, B), ARG_MIN(V, I), ARG_MIN(V, S), ARG_MIN(V, T), ARG_MIN(V, R), ARG_MIN(V, D), ARG_MIN(V, E) FROM T; B | I | S | T | R | D | E --------------------------- - 0| 0| 0| 0| 0| 0| 0 + 0 | 0 | 0 | 0 | 0 | 0 | 0 (1 row) SELECT ARG_MAX(V, B), ARG_MAX(V, I), ARG_MAX(V, S), ARG_MAX(V, T), @@ -310,13 +310,13 @@ SELECT ARG_MAX(V, B), ARG_MAX(V, I), ARG_MAX(V, S), ARG_MAX(V, T), FROM T; B | I | S | T | R | D | E --------------------------- - 2| 2| 2| 2| 2| 2| 2 + 2 | 2 | 2 | 2 | 2 | 2 | 2 (1 row)"""); } @Test public void testAggregates() { - this.qs(""" + this.qst(""" SELECT COUNT(*), COUNT(B), COUNT(I), COUNT(S), COUNT(T), COUNT(R), COUNT(D), COUNT(E) FROM T; * | B | I | S | T | R | D | E ------------------------------- @@ -386,7 +386,7 @@ public void testAggregates() { @Test public void testDistinctAggregates() { - this.qs(""" + this.qst(""" SELECT COUNT(*), COUNT(DISTINCT B), COUNT(DISTINCT I), COUNT(DISTINCT S), COUNT(DISTINCT T), COUNT(DISTINCT R), COUNT(DISTINCT D), COUNT(DISTINCT E) FROM T; * | B | I | S | T | R | D | E ------------------------------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/ArrayFunctionsTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/ArrayFunctionsTests.java index 6f4527ec28d..f51522b80a4 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/ArrayFunctionsTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/ArrayFunctionsTests.java @@ -6,7 +6,7 @@ public class ArrayFunctionsTests extends SqlIoTest { @Test public void testArrayAppend() { - this.qs(""" + this.qst(""" SELECT array_append(ARRAY [1, 2], null::int); array_append -------------- @@ -38,7 +38,7 @@ public void testArrayAppend() { public void testArrayConcat() { this.statementsFailingInCompilation("CREATE VIEW V AS SELECT array_concat()", "Invalid number of arguments to function"); - this.qs(""" + this.qst(""" SELECT array_concat(array[1, 2], array[2, 3]); r --- @@ -66,7 +66,7 @@ public void testArrayConcat() { @Test public void testArrayExcept() { - this.qs(""" + this.qst(""" SELECT array_except(array[2, 3, 3], array[2]); r --- @@ -106,7 +106,7 @@ public void testArrayExcept() { @Test public void testArrayUnion() { - this.qs(""" + this.qst(""" select array_union(array[2, 3, 3], array[3]); r --- @@ -140,7 +140,7 @@ public void testArrayUnion() { @Test public void testArrayRepeat() { - this.qs(""" + this.qst(""" SELECT array_repeat(3, 3); array_repeat -------------- @@ -176,7 +176,7 @@ public void testArrayRepeat() { @Test public void testArrayRepeat2() { - this.qs(""" + this.qst(""" SELECT array_repeat(123, null); array_repeat -------------- @@ -188,7 +188,7 @@ public void testArrayRepeat2() { @Test public void testArrayRepeat3() { - this.qs(""" + this.qst(""" SELECT array_repeat('a', 6); array_repeat -------------- @@ -200,7 +200,7 @@ public void testArrayRepeat3() { @Test public void testArrayPosition() { - this.qs(""" + this.qst(""" SELECT array_position(ARRAY [2, 4, 6, 8, null], null); array_position ---------------- @@ -255,7 +255,7 @@ public void testArrayPosition() { @Test public void testArrayContains() { - this.qs(""" + this.qst(""" SELECT array_contains(ARRAY [2, 4, 6, 8, null], 4); array_contains --------------- @@ -297,7 +297,7 @@ public void testArrayContains() { @Test public void testArrayPositionDiffTypes() { - this.qs(""" + this.qst(""" SELECT array_position(ARRAY [1, 2, 3, 4], 1e0); result -------- @@ -319,7 +319,7 @@ public void testArrayPositionDiffTypes() { @Test public void testArrayContainsDiffTypes() { - this.qs(""" + this.qst(""" SELECT array_contains(ARRAY [1, 2, 3, 4], 1e0); result -------- @@ -341,7 +341,7 @@ public void testArrayContainsDiffTypes() { @Test public void testArrayRemoveDiffTypes() { - this.qs(""" + this.qst(""" SELECT array_remove(ARRAY [1, 2, 3, 4], 1e0); result -------- @@ -363,7 +363,7 @@ public void testArrayRemoveDiffTypes() { @Test public void testArrayRemove() { - this.qs(""" + this.qst(""" SELECT array_remove(ARRAY [2, 2, 6, 6, 8, 2], 2); array_remove -------------- @@ -431,7 +431,7 @@ public void testNullArray() { @Test public void testArrayPrepend() { - this.qs(""" + this.qst(""" SELECT array_prepend(ARRAY [2, 3], 1); array_prepend --------------- @@ -479,7 +479,7 @@ public void testArrayPrepend() { @Test public void testCardinality() { - this.qs(""" + this.qst(""" SELECT cardinality(ARRAY [1]); cardinality ------------- @@ -503,7 +503,7 @@ public void testCardinality() { @Test public void testSortArray() { - this.qs(""" + this.qst(""" SELECT sort_array(ARRAY [7, 1, 4, 3]); sort_array ------------ @@ -569,7 +569,7 @@ public void testSortArray() { @Test public void testArraySize() { - this.qs(""" + this.qst(""" SELECT cardinality(ARRAY [1, 2, 3]); array_size ------------ @@ -616,7 +616,7 @@ public void testArraySize() { @Test public void testArrayReverse() { - this.qs(""" + this.qst(""" SELECT ARRAY_REVERSE(ARRAY [2, 3, 3]); array_reverse --------------- @@ -652,7 +652,7 @@ public void testArrayReverse() { @Test public void testArrayMinMax() { - this.qs(""" + this.qst(""" SELECT array_max(ARRAY [9, 1, 2, 4, 8]); array_max ----------- @@ -683,7 +683,7 @@ public void testArrayMinMax() { // Test for https://github.com/feldera/feldera/issues/1472 @Test public void testArrayCompact2() { - this.qs(""" + this.qst(""" SELECT array_compact(ARRAY [NULL]); array_compact --------------- @@ -694,7 +694,7 @@ public void testArrayCompact2() { @Test public void testArrayCompact() { - this.qs(""" + this.qst(""" SELECT array_compact(ARRAY [1, null, 2, null]); array_compact --------------- @@ -754,7 +754,7 @@ public void testArrayCompact() { @Test public void testArrayDistinct() { - this.qs(""" + this.qst(""" SELECT array_distinct(ARRAY [1, 1, 2, 2, 3, 3]); array_distinct ---------------- @@ -829,7 +829,7 @@ public void issue3272() { @Test public void testArraysOverlap() { - this.qs(""" + this.qst(""" SELECT ARRAYS_OVERLAP(null, null); arrays_overlap ---------------- @@ -929,7 +929,7 @@ public void testArraysOverlapDiffTypes() { @Test public void testArrayAgg() { // Tests from https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#array_agg - this.qs(""" + this.qst(""" SELECT ARRAY_AGG(x) AS array_agg FROM UNNEST(ARRAY [2, 1,-2, 3, -2, 1, 2]) AS x; +-------------------------+ | array_agg | @@ -978,7 +978,7 @@ SELECT x, ARRAY_AGG(y) as array_agg @Test public void testOverArrayAgg() { // The order of the elements in the array is non-deterministic - this.qs(""" + this.qst(""" SELECT x, ARRAY_AGG(x) OVER (ORDER BY ABS(x)) AS array_agg @@ -999,7 +999,7 @@ public void testOverArrayAgg() { @Test public void testArrayIntersect() { - this.qs(""" + this.qst(""" select array_intersect(array[2, 3, 3], array[3]); r --- @@ -1039,7 +1039,7 @@ public void testArrayIntersect() { @Test public void testArrayInsert() { - this.qs(""" + this.qst(""" select array_insert(cast(null as integer array), 3, 4); r --- @@ -1144,7 +1144,7 @@ public void testArrayInsert() { @Test public void testExists() { - this.qs(""" + this.qst(""" SELECT array_EXISTS(array[1, 2, 3], x -> x > 2); result ------ @@ -1265,7 +1265,7 @@ public void testArrayExistsTable() { @Test public void testTransform() { - this.qs(""" + this.qst(""" SELECT transform(array[1, 2, 3], x -> x + 3); result ------ diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CalciteSqlOperatorTest.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CalciteSqlOperatorTest.java index 3bcb38349c5..5ca69515e39 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CalciteSqlOperatorTest.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CalciteSqlOperatorTest.java @@ -7,7 +7,7 @@ public class CalciteSqlOperatorTest extends SqlIoTest { @Test public void testIf() { - this.qs(""" + this.qst(""" SELECT if(1 = 2, 1, 2); result -------- @@ -53,7 +53,7 @@ public void testIf() { @Test public void testRegexReplace2Func() { - this.qs(""" + this.qst(""" select regexp_replace('a b c', 'b'); r --- @@ -81,6 +81,7 @@ public void testRegexReplace2Func() { @Test public void testRegexReplace3Func() { + // Spaces are significant in these outputs this.qs(""" select regexp_replace('a b c', 'b', 'X'); r @@ -181,7 +182,7 @@ select regexp_replace('abc\t @Test public void testDocs() { - this.qs(""" + this.qst(""" select regexp_replace('1078910', '[^01]'); r ----- @@ -209,7 +210,7 @@ public void testDocs() { @Test public void testConcatWithSeparator() { - this.qs(""" + this.qst(""" select concat_ws(',', 'a'); r --- @@ -276,7 +277,7 @@ public void testConcatWithSeparator() { @Test public void testMapContainsKey() { - this.qs(""" + this.qst(""" select map_contains_key(map[1, 'a', 2, 'b'], 1); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CastTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CastTests.java index 14d50e927c2..a096f512081 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CastTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/CastTests.java @@ -156,7 +156,7 @@ public void runtimeOverflowsTests() { @Test public void mixedTypesTest() { - this.qs("SELECT CAST(100 AS UNSIGNED) - 10;" + + this.qst("SELECT CAST(100 AS UNSIGNED) - 10;" + """ t --- @@ -202,7 +202,7 @@ public void mixedTypesTest() { @Test public void timeCastTests() { - this.qs(""" + this.qst(""" SELECT CAST(1000 AS TIMESTAMP); t --- @@ -254,7 +254,7 @@ public void timeCastTests() { @Test public void testCastStringToComplexLongInterval() { - this.qs(""" + this.qst(""" SELECT CAST('1-1' AS INTERVAL YEAR TO MONTH); i --- @@ -276,7 +276,7 @@ public void testCastStringToComplexLongInterval() { @Test public void testCastStringToComplexShortInterval() { - this.qs(""" + this.qst(""" SELECT CAST('100 1' AS INTERVAL DAY TO HOUR); i --- @@ -304,7 +304,7 @@ public void testCastStringToComplexShortInterval() { @Test public void testCastStringToComplexShortInterval2() { - this.qs(""" + this.qst(""" SELECT CAST('10 10:1' AS INTERVAL DAYS TO MINUTES); i --- @@ -344,7 +344,7 @@ public void testCastStringToComplexShortInterval2() { @Test public void testCastStringToComplexShortInterval1() { - this.qs(""" + this.qst(""" SELECT CAST('100:1' AS INTERVAL MINUTES TO SECONDS); i --- @@ -384,7 +384,7 @@ public void testCastStringToComplexShortInterval1() { @Test public void testCastStringToSimpleInterval() { - this.qs(""" + this.qst(""" SELECT CAST('1' AS INTERVAL YEAR); i --- @@ -718,7 +718,7 @@ enum CanConvert { @Test public void issue5894() { - this.qs(""" + this.qst(""" SELECT INTERVAL '1' YEAR; r --- @@ -762,7 +762,7 @@ public void issue5895() { @Test public void issue6257() { // Calcite rounds by truncating, so we are tied to that behavior - this.qs(""" + this.qst(""" SELECT CAST(INTERVAL '10' DAY AS BIGINT); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/DateArithmeticTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/DateArithmeticTests.java index 57dcde5b98a..70f94dd1742 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/DateArithmeticTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/DateArithmeticTests.java @@ -6,7 +6,7 @@ public class DateArithmeticTests extends SqlIoTest { @Test public void testTimeAddInterval() { - this.qs(""" + this.qst(""" SELECT DATE '2024-01-01' + INTERVAL '10' MINUTES; date ---------- @@ -186,7 +186,7 @@ public void testTimeAddInterval() { @Test public void testTimeSubInterval() { - this.qs(""" + this.qst(""" SELECT DATE '2024-01-01' - INTERVAL '10' MINUTES; date ---------- @@ -358,7 +358,7 @@ public void testTimeSubInterval() { @Test public void testDateSub() { - this.qs(""" + this.qst(""" SELECT (date '2023-12-01' - date '2022-12-01') days; diff ------ @@ -394,7 +394,7 @@ public void testDateSub() { ------ 334 days ago (1 row)"""); - this.qs(""" + this.qst(""" SELECT (TIMESTAMP '2023-01-01 10:00:00' - TIMESTAMP '2023-12-01 10:00:00') month; diff ------ @@ -404,7 +404,7 @@ public void testDateSub() { @Test public void makeDateTests() { - this.qs(""" + this.qst(""" SELECT MAKE_DATE(2020, 1, 1); r --- @@ -465,7 +465,7 @@ public void makeDateTests() { @Test public void makeTimestampTests() { - this.qs(""" + this.qst(""" SELECT MAKE_TIMESTAMP(2020, 1, 1, 10, 0, 0); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/LateralAliasTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/LateralAliasTests.java index 2372dfc922d..3451f7ac903 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/LateralAliasTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/LateralAliasTests.java @@ -15,7 +15,7 @@ public void prepareInputs(DBSPCompiler compiler) { @Test public void lateralTest() { // Tests from the SQL documentation in docs/sql/identifiers.md - this.qs(""" + this.qst(""" SELECT 1 as X, X+X as Y; x | y ------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/OuterJoinTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/OuterJoinTests.java index d46d6e2e24a..1ced2b3533d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/OuterJoinTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/OuterJoinTests.java @@ -112,7 +112,7 @@ public void testCommonIndex() { @Test public void testPredicatePullLeftJoin() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L LEFT JOIN A AS R ON L.X = R.X and L.Y = 0; lx | ly | lx | ly ------------------- @@ -241,7 +241,7 @@ public void testPredicatePullLeftJoin() { @Test public void testPredicatePullRightJoin() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L RIGHT JOIN A AS R ON L.X = R.X and L.Y = 0; lx | ly | lx | ly ------------------- @@ -362,7 +362,7 @@ public void testPredicatePullRightJoin() { @Test public void testStandadJoinCondition() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L LEFT JOIN A AS R ON L.X = R.X and L.Y = R.Y; lx | ly | lx | ly ------------------- @@ -483,7 +483,7 @@ public void testStandadJoinCondition() { @Test public void testNonEqui() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L LEFT JOIN A AS R ON L.X < R.X and L.Y = R.Y; lx | ly | lx | ly ------------------- @@ -604,7 +604,7 @@ public void testNonEqui() { @Test public void testDistinct() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L LEFT JOIN A AS R ON L.X IS NOT DISTINCT FROM R.X and L.Y IS NOT DISTINCT FROM R.Y; lx | ly | lx | ly ------------------- @@ -725,7 +725,7 @@ public void testDistinct() { @Test public void testMix() { // validated on postgres - this.qs(""" + this.qst(""" SELECT * FROM A AS L LEFT JOIN A AS R ON L.X = R.X and L.Y IS NOT DISTINCT FROM R.Y; lx | ly | lx | ly ------------------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/PivotTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/PivotTests.java index 5bd98a233d3..82782e8d96f 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/PivotTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/PivotTests.java @@ -38,21 +38,18 @@ Create Table GG ( @Test public void testGroupby() { - this.q(""" + this.qst(""" SELECT CourseName, Sum(Price) FROM GG GROUP BY CourseName; - CourseName | Price - ----------------- - C| 5000 - JAVA| 6000 - PLACEMENT 100| 5000 - PYTHON| 8000"""); - } - - @Test - public void testGGPivot() { - this.q(""" + CourseName | Price + ---------------------- + C | 5000 + JAVA | 6000 + PLACEMENT 100 | 5000 + PYTHON | 8000 + (4 rows) + SELECT CourseName, PG, IV FROM GG PIVOT ( @@ -61,17 +58,18 @@ public void testGGPivot() { 'INTERVIEWPREPARATION' AS IV ) ) AS PivotTable; - CourseName | PG | IV - ----------------- - C| 5000 | NULL - JAVA| 6000 | NULL - PLACEMENT 100| NULL | 5000 - PYTHON| 8000 | NULL"""); + CourseName | PG | IV + ----------------------------- + C | 5000 | NULL + JAVA | 6000 | NULL + PLACEMENT 100 | NULL | 5000 + PYTHON | 8000 | NULL + (4 rows)"""); } @Test public void testSparkPivot() { - this.q(""" + this.qst(""" SELECT * FROM person PIVOT ( SUM(age) AS a, AVG(class) AS cc @@ -80,13 +78,13 @@ FOR name IN ('John' AS john, 'Mike' AS mike) +------+-----------+---------+---------+---------+---------+ | id | address | john_a | john_cc | mike_a | mike_cc | +------+-----------+---------+---------+---------+---------+ - | 200 | Street 2| NULL | NULL | NULL | NULL | - | 100 | Street 1| 30 | 1 | NULL | NULL | - | 300 | Street 3| NULL | NULL | 80 | 3 | - | 400 | Street 4| NULL | NULL | NULL | NULL | + | 200 | Street 2 | NULL | NULL | NULL | NULL | + | 100 | Street 1 | 30 | 1 | NULL | NULL | + | 300 | Street 3 | NULL | NULL | 80 | 3 | + | 400 | Street 4 | NULL | NULL | NULL | NULL | +------+-----------+---------+---------+---------+---------+ - """); - this.q(""" + (4 rows) + SELECT * FROM person PIVOT ( SUM(age) AS a, AVG(class) AS cc @@ -95,25 +93,27 @@ FOR name IN ('John' AS john, 'Mike' AS mike) +------+-----------+-------+-------+-------+-------+ | id | address | c1_a | c1_cc | c2_a | c2_cc | +------+-----------+-------+-------+-------+-------+ - | 200 | Street 2| NULL | NULL | NULL | NULL | - | 100 | Street 1| 30 | 1 | NULL | NULL | - | 300 | Street 3| NULL | NULL | NULL | NULL | - | 400 | Street 4| NULL | NULL | NULL | NULL | - +------+-----------+-------+-------+-------+-------+"""); + | 200 | Street 2 | NULL | NULL | NULL | NULL | + | 100 | Street 1 | 30 | 1 | NULL | NULL | + | 300 | Street 3 | NULL | NULL | NULL | NULL | + | 400 | Street 4 | NULL | NULL | NULL | NULL | + +------+-----------+-------+-------+-------+-------+ + (4 rows)"""); } @Test public void testPivotDoc() { - this.q(""" + this.qst(""" SELECT year, type, SUM(count) FROM FURNITURE GROUP BY year, type; year | type | sum ----------------- - 2020 | chair| 4 - 2021 | table| 3 - 2021 | chair| 4 - 2023 | desk| 1 - 2023 | table| 2"""); - this.q(""" + 2020 | chair | 4 + 2021 | table | 3 + 2021 | chair | 4 + 2023 | desk | 1 + 2023 | table | 2 + (5 rows) + SELECT * FROM FURNITURE PIVOT ( SUM(count) AS ct @@ -124,6 +124,6 @@ FOR type IN ('desk' AS desks, 'table' AS tables, 'chair' as chairs) 2020 | | | 4 2021 | | 3 | 4 2023 | 1 | 2 | - """); + (3 rows)"""); } } diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression1Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression1Tests.java index 5ab2906f4b7..83493b18714 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression1Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression1Tests.java @@ -255,7 +255,7 @@ NOT EXISTS ( @Test public void issue4562() { - this.qs(""" + this.qst(""" SELECT TIMESTAMPADD(MINUTE, 2, '2020-06-21 14:23:44.123'::TIMESTAMP); r --- @@ -508,7 +508,7 @@ public void issue4263() { @Test public void issue4264() { - this.qs(""" + this.qst(""" SELECT TRIM(trailing '' FROM 'x'); result -------- @@ -757,6 +757,7 @@ CREATE TABLE row_tbl( @Test public void issue5087() { + // Spaces are significant this.qs(""" SELECT '1 2' AS r; @@ -1422,7 +1423,7 @@ CREATE TABLE tbl(id INT, @Test public void testBinaryStringCast() { - this.qs(""" + this.qst(""" SELECT bin2utf8(x'404141'); r --- @@ -1632,7 +1633,7 @@ public void issue5352() { @Test public void issue5352_a() { - this.qs(""" + this.qst(""" SELECT 'TRUE'::BOOLEAN; r --- @@ -1876,7 +1877,7 @@ public void issue5380() { @Test public void safeArrayCast() { - this.qs(""" + this.qst(""" SELECT SAFE_CAST(ARRAY['a'] AS INT ARRAY); r --- @@ -1892,7 +1893,7 @@ public void safeArrayCast() { @Test public void safeNestedArrayCast() { - this.qs(""" + this.qst(""" SELECT SAFE_CAST(ARRAY[ARRAY['a']] AS INT ARRAY ARRAY); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression2Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression2Tests.java index 95b5e778020..cd913406d64 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression2Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression2Tests.java @@ -605,7 +605,7 @@ and exists ( @Test public void testBetween() { - this.qs(""" + this.qst(""" SELECT 1 BETWEEN 2 AND 0; r --- @@ -627,7 +627,7 @@ public void testBetween() { @Test public void testStdDevPop() { - this.qs(""" + this.qst(""" WITH T(x) as (VALUES(CAST(NULL AS DECIMAL(5, 2)))) SELECT STDDEV_POP(x) FROM T; r --- @@ -911,7 +911,7 @@ h DECIMAL(38, 10), @Test public void issue5981() { - this.qs(""" + this.qst(""" SELECT TO_HEX(x'48656c6c6f'); r --- @@ -992,7 +992,7 @@ public void issue5927() { @Test public void testXxHash() { - this.qs(""" + this.qst(""" SELECT XXHASH('abc', 2); r --- @@ -1061,7 +1061,7 @@ public void calciteIssue7501() { @Test public void testFiniteOrNull() { - this.qs(""" + this.qst(""" SELECT FINITE_OR_NULL(1e0); r --- @@ -1100,7 +1100,7 @@ public void issue6181() { r --- NULL"""); - this.qs(""" + this.qst(""" SELECT INTERVAL '+1' HOURS / 5; r --- @@ -1687,7 +1687,7 @@ public void issue4146() { @Test public void issue4146a() { // Validated on postgres - this.qs(""" + this.qst(""" SELECT COALESCE(NULL, TIMESTAMP WITH TIME ZONE '2020-01-01 10:10:10 America/New_York'); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression3Tests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression3Tests.java index 20c27e04fee..4503fb59274 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression3Tests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/Regression3Tests.java @@ -618,7 +618,7 @@ CREATE TABLE T ( @Test public void issue6352() { - this.qs(""" + this.qst(""" SELECT SAFE_CAST('true' AS BOOL); r --- @@ -643,7 +643,7 @@ public void issue6352() { NULL (1 row)"""); - this.qs(""" + this.qst(""" SELECT SAFE_CAST('0.0' AS DOUBLE); r --- @@ -662,7 +662,7 @@ public void issue6352() { NULL (1 row)"""); - this.qs(""" + this.qst(""" SELECT SAFE_CAST('0.0' AS REAL); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/RegressionTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/RegressionTests.java index a89dd527325..f3392a6ce77 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/RegressionTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/RegressionTests.java @@ -1714,7 +1714,7 @@ public void missingCast() { @Test public void testDiv() { - this.qs(""" + this.qst(""" SELEct 95.0/100; r ---- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StringTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StringTests.java index 576889478b4..de95d44d779 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StringTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StringTests.java @@ -14,7 +14,7 @@ public void testReverseNegative() { @Test public void testReverse() { - this.qs(""" + this.qst(""" SELECT REVERSE('Feldera'); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StructTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StructTests.java index 950fbb150ad..8fee6572d94 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StructTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/StructTests.java @@ -23,9 +23,9 @@ public class StructTests extends SqlIoTest { @Test public void issue3262() { // Duplicates a test from CatalogTests, since programs with handles cannot be used to generate Rust tests. - var ccs = this.getCCS( - "CREATE TABLE fails (named_pairs MAP);" + - "CREATE VIEW V AS SELECT named_pairs['a'].k FROM fails;"); + var ccs = this.getCCS(""" + CREATE TABLE fails (named_pairs MAP); + CREATE VIEW V AS SELECT named_pairs['a'].k FROM fails;"""); ccs.stepWeightOne("INSERT INTO fails VALUES(MAP['a', ROW('2', '3'), 'b', NULL])", """ result diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeArithmeticTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeArithmeticTests.java index d994677d330..dab71732e12 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeArithmeticTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeArithmeticTests.java @@ -6,7 +6,7 @@ public class TimeArithmeticTests extends SqlIoTest { @Test public void testTimestampAddLongInterval() { - this.qs(""" + this.qst(""" SELECT TIMESTAMP '2024-01-01 10:23:45' + INTERVAL 10 MONTHS; ts --------------------- @@ -118,7 +118,7 @@ public void testTimestampAddLongInterval() { @Test public void testTimeAddInterval() { - this.qs(""" + this.qst(""" SELECT '23:00:00'::time + INTERVAL '10' MINUTES; time ---------- @@ -316,7 +316,7 @@ public void testTimeAddInterval() { @Test public void testTimeSubInterval() { - this.qs(""" + this.qst(""" SELECT '00:00:00'::time - INTERVAL '10' MINUTES; time -------- @@ -417,7 +417,7 @@ public void testTimeSubInterval() { @Test public void testTimeAddInterval1() { - this.qs(""" + this.qst(""" SELECT '12:34:56'::time + INTERVAL '25' DAYS; time --------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeTests.java index 46500c0cae7..b9361faad5d 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TimeTests.java @@ -253,7 +253,7 @@ public void timestampDiffTest() { @Test public void testMakeTime() { - this.qs(""" + this.qst(""" SELECT MAKE_TIME(1, 2, 3); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TinyintTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TinyintTests.java index 7ff6157a5ad..1ec95a8f917 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TinyintTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TinyintTests.java @@ -22,7 +22,7 @@ INSERT INTO INT_TBL(f1) VALUES @Test public void testSelect() { - this.qs( + this.qst( """ SELECT * FROM INT_TBL; f1 diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TrigonometryTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TrigonometryTests.java index 63259b630f3..190b2ceb6ce 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TrigonometryTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/TrigonometryTests.java @@ -7,7 +7,7 @@ public class TrigonometryTests extends SqlIoTest { // Tested using Postgres 15.2 @Test public void testSin() { - this.qs( + this.qst( """ SELECT sin(null); sin @@ -56,7 +56,7 @@ public void testSin() { // Tested using Postgres 15.2 @Test public void testSinDouble() { - this.qs( + this.qst( """ SELECT sin(CAST(0 AS DOUBLE)); sin @@ -93,7 +93,7 @@ public void testSinDouble() { // Tested using Postgres 15.2 @Test public void testCos() { - this.qs( + this.qst( """ SELECT cos(null); cos @@ -142,7 +142,7 @@ public void testCos() { // Tested using Postgres 15.2 @Test public void testCosDouble() { - this.qs( + this.qst( """ SELECT cos(CAST(0 AS DOUBLE)); cos @@ -191,7 +191,7 @@ public void testPi() { // Tested using Postgres 15.2 @Test public void testTan() { - this.qs( + this.qst( """ SELECT tan(null); tan @@ -240,7 +240,7 @@ public void testTan() { // Tested using Postgres 15.2 @Test public void testTanDouble() { - this.qs( + this.qst( """ SELECT tan(CAST(null as DOUBLE)); tan @@ -283,7 +283,7 @@ public void testTanDouble() { // Tested using Postgres 15.2 @Test public void testCot() { - this.qs( + this.qst( """ SELECT cot(0); cot @@ -332,7 +332,7 @@ public void testCot() { // Tested using Postgres 15.2 @Test public void testCotDouble() { - this.qs( + this.qst( """ SELECT cot(CAST(0 AS DOUBLE)); cot @@ -383,7 +383,7 @@ public void testCotDouble() { // Right now, we return a NaN, instead of throwing an error @Test public void testAsin() { - this.qs( + this.qst( """ SELECT asin(null); asin @@ -464,7 +464,7 @@ public void testAsin() { // Right now, we return a NaN, instead of throwing an error @Test public void testAsinDouble() { - this.qs( + this.qst( """ SELECT asin(CAST(-2 AS DOUBLE)); asin @@ -539,7 +539,7 @@ public void testAsinDouble() { // Right now, we return a NaN, instead of throwing an error @Test public void testAcos() { - this.qs( + this.qst( """ SELECT acos(null); acos @@ -620,7 +620,7 @@ public void testAcos() { // Right now, we return a NaN, instead of throwing an error @Test public void testAcosDouble() { - this.qs( + this.qst( """ SELECT acos(CAST(-2 AS DOUBLE)); acos @@ -693,7 +693,7 @@ public void testAcosDouble() { // Tested using Postgres 15.2 @Test public void testAtan() { - this.qs( + this.qst( """ SELECT atan(null); atan @@ -760,7 +760,7 @@ public void testAtan() { // Tested using Postgres 15.2 @Test public void testAtanDouble() { - this.qs( + this.qst( """ SELECT atan(CAST(null as DOUBLE)); atan @@ -827,7 +827,7 @@ public void testAtanDouble() { // Tested using Postgres 15.2 @Test public void testAtan2() { - this.qs( + this.qst( """ SELECT atan2(null, null); atan2 @@ -870,7 +870,7 @@ public void testAtan2() { // Tested using Postgres 15.2 @Test public void testAtan2Double() { - this.qs( + this.qst( """ SELECT atan2(CAST(0 AS DOUBLE), CAST(0 AS DOUBLE)); atan2 @@ -901,7 +901,7 @@ public void testAtan2Double() { // Tested using Postgres 15.2 @Test public void testRadians() { - this.qs( + this.qst( """ SELECT radians(null); radians @@ -956,7 +956,7 @@ public void testRadians() { // Tested using Postgres 15.2 @Test public void testRadiansDouble() { - this.qs( + this.qst( """ SELECT radians(CAST(null AS DOUBLE)); radians @@ -1011,7 +1011,7 @@ public void testRadiansDouble() { // Tested using Postgres 15.2 @Test public void testDegrees() { - this.qs( + this.qst( """ SELECT degrees(null); degrees @@ -1066,7 +1066,7 @@ public void testDegrees() { // Tested on Postgres @Test public void validInputs() { - this.qs( + this.qst( """ SELECT sin('-3'); sin @@ -1121,7 +1121,7 @@ public void invalidInputs() { // Tested on Apache Spark @Test public void testSec() { - this.qs(""" + this.qst(""" SELECT ROUND(sec(0.6), 12); sec ----------------- @@ -1152,7 +1152,7 @@ public void testSec() { // Tested on Apache Spark @Test public void testCsc() { - this.qs(""" + this.qst(""" SELECT csc(0.6); csc ----------------- @@ -1176,7 +1176,7 @@ public void testCsc() { @Test public void testHyperbolicFns() { - this.qs( + this.qst( """ SELECT ROUND(sinh(1), 12); sinh @@ -1249,7 +1249,7 @@ public void testHyperbolicFns() { @Test public void testArcHyperbolic() { - this.qs(""" + this.qst(""" SELECT asinh('Infinity'::float8); asinh ---------- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/VariantTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/VariantTests.java index 4b3bbc53f04..de27aa1d0f2 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/VariantTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/simple/VariantTests.java @@ -501,7 +501,7 @@ public void testSparkInline() { @Test public void issue5938() { // type -> Variant -> string - this.qs(""" + this.qst(""" SELECT CAST(CAST(1 AS VARIANT) AS VARCHAR); r --- @@ -573,7 +573,7 @@ public void issue5938() { @Test public void issue5938a() { // String -> Variant -> type - this.qs(""" + this.qst(""" SELECT CAST(CAST('1' AS VARIANT) AS INT); r --- diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/tools/SqlIoTest.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/tools/SqlIoTest.java index 7b7766067fa..7808a7a6c06 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/tools/SqlIoTest.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/tools/SqlIoTest.java @@ -290,6 +290,10 @@ public void qst(String queriesWithOutputs) { this.qs(queriesWithOutputs, TestOptimizations.Both, true); } + public void qst(String queriesWithOutputs, TestOptimizations to) { + this.qs(queriesWithOutputs, to, true); + } + public void qs(String queriesWithOutputs) { this.qs(queriesWithOutputs, TestOptimizations.Both, false); }