blob: 1b4afc2516f8397bc90deb00ca45146ff11315ae [file] [log] [blame]
-- Automatically generated by SQLQueryTestSuite
-- !query
CREATE OR REPLACE TEMPORARY VIEW INT4_TBL AS SELECT * FROM
(VALUES (0), (123456), (-123456), (2147483647), (-2147483647))
AS v(f1)
-- !query analysis
CreateViewCommand `INT4_TBL`, SELECT * FROM
(VALUES (0), (123456), (-123456), (2147483647), (-2147483647))
AS v(f1), false, true, LocalTempView, true
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
CREATE OR REPLACE TEMPORARY VIEW INT8_TBL AS SELECT * FROM
(VALUES
(123, 456),
(123, 4567890123456789),
(4567890123456789, 123),
(4567890123456789, 4567890123456789),
(4567890123456789, -4567890123456789))
AS v(q1, q2)
-- !query analysis
CreateViewCommand `INT8_TBL`, SELECT * FROM
(VALUES
(123, 456),
(123, 4567890123456789),
(4567890123456789, 123),
(4567890123456789, 4567890123456789),
(4567890123456789, -4567890123456789))
AS v(q1, q2), false, true, LocalTempView, true
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
CREATE OR REPLACE TEMPORARY VIEW FLOAT8_TBL AS SELECT * FROM
(VALUES (0.0), (-34.84), (-1004.30),
(CAST('-1.2345678901234e+200' AS DOUBLE)), (CAST('-1.2345678901234e-200' AS DOUBLE)))
AS v(f1)
-- !query analysis
CreateViewCommand `FLOAT8_TBL`, SELECT * FROM
(VALUES (0.0), (-34.84), (-1004.30),
(CAST('-1.2345678901234e+200' AS DOUBLE)), (CAST('-1.2345678901234e-200' AS DOUBLE)))
AS v(f1), false, true, LocalTempView, true
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT 1 AS two UNION SELECT 2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [1 AS two#x]
: +- OneRowRelation
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1 AS one UNION SELECT 1 ORDER BY 1
-- !query analysis
Sort [one#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [1 AS one#x]
: +- OneRowRelation
+- Project [1 AS 1#x]
+- OneRowRelation
-- !query
SELECT 1 AS two UNION ALL SELECT 2
-- !query analysis
Union false, false
:- Project [1 AS two#x]
: +- OneRowRelation
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1 AS two UNION ALL SELECT 1
-- !query analysis
Union false, false
:- Project [1 AS two#x]
: +- OneRowRelation
+- Project [1 AS 1#x]
+- OneRowRelation
-- !query
SELECT 1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1
-- !query analysis
Sort [three#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [1 AS three#x]
: : +- OneRowRelation
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [3 AS 3#x]
+- OneRowRelation
-- !query
SELECT 1 AS two UNION SELECT 2 UNION SELECT 2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [1 AS two#x]
: : +- OneRowRelation
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1
-- !query analysis
Sort [three#x ASC NULLS FIRST], true
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [1 AS three#x]
: : +- OneRowRelation
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS two UNION SELECT 2.2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [1.1 AS two#x]
: +- OneRowRelation
+- Project [2.2 AS 2.2#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS two UNION SELECT 2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [cast(two#x as decimal(11,1)) AS two#x]
: +- Project [1.1 AS two#x]
: +- OneRowRelation
+- Project [cast(2#x as decimal(11,1)) AS 2#x]
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1 AS two UNION SELECT 2.2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [cast(two#x as decimal(11,1)) AS two#x]
: +- Project [1 AS two#x]
: +- OneRowRelation
+- Project [cast(2.2#x as decimal(11,1)) AS 2.2#x]
+- Project [2.2 AS 2.2#x]
+- OneRowRelation
-- !query
SELECT 1 AS one UNION SELECT double(1.0) ORDER BY 1
-- !query analysis
Sort [one#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [cast(one#x as double) AS one#x]
: +- Project [1 AS one#x]
: +- OneRowRelation
+- Project [cast(1.0 as double) AS 1.0#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS two UNION ALL SELECT 2 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Union false, false
:- Project [cast(two#x as decimal(11,1)) AS two#x]
: +- Project [1.1 AS two#x]
: +- OneRowRelation
+- Project [cast(2#x as decimal(11,1)) AS 2#x]
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT double(1.0) AS two UNION ALL SELECT 1 ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Union false, false
:- Project [cast(1.0 as double) AS two#x]
: +- OneRowRelation
+- Project [cast(1#x as double) AS 1#x]
+- Project [1 AS 1#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1
-- !query analysis
Sort [three#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [cast(three#x as decimal(11,1)) AS three#x]
: : +- Project [1.1 AS three#x]
: : +- OneRowRelation
: +- Project [cast(2#x as decimal(11,1)) AS 2#x]
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [cast(3#x as decimal(11,1)) AS 3#x]
+- Project [3 AS 3#x]
+- OneRowRelation
-- !query
SELECT double(1.1) AS two UNION SELECT 2 UNION SELECT double(2.0) ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [cast(1.1 as double) AS two#x]
: : +- OneRowRelation
: +- Project [cast(2#x as double) AS 2#x]
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [cast(2.0 as double) AS 2.0#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1
-- !query analysis
Sort [three#x ASC NULLS FIRST], true
+- Union false, false
:- Distinct
: +- Union false, false
: :- Project [cast(three#x as decimal(11,1)) AS three#x]
: : +- Project [1.1 AS three#x]
: : +- OneRowRelation
: +- Project [cast(2#x as decimal(11,1)) AS 2#x]
: +- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [cast(2#x as decimal(11,1)) AS 2#x]
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2) ORDER BY 1
-- !query analysis
Sort [two#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [cast(two#x as decimal(11,1)) AS two#x]
: +- Project [1.1 AS two#x]
: +- OneRowRelation
+- Project [cast(2#x as decimal(11,1)) AS 2#x]
+- Union false, false
:- Project [2 AS 2#x]
: +- OneRowRelation
+- Project [2 AS 2#x]
+- OneRowRelation
-- !query
SELECT f1 AS five FROM FLOAT8_TBL
UNION
SELECT f1 FROM FLOAT8_TBL
ORDER BY 1
-- !query analysis
Sort [five#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [f1#x AS five#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [f1#x]
+- SubqueryAlias float8_tbl
+- View (`FLOAT8_TBL`, [f1#x])
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT f1 AS ten FROM FLOAT8_TBL
UNION ALL
SELECT f1 FROM FLOAT8_TBL
-- !query analysis
Union false, false
:- Project [f1#x AS ten#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [f1#x]
+- SubqueryAlias float8_tbl
+- View (`FLOAT8_TBL`, [f1#x])
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT f1 AS nine FROM FLOAT8_TBL
UNION
SELECT f1 FROM INT4_TBL
ORDER BY 1
-- !query analysis
Sort [nine#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [f1#x AS nine#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias int4_tbl
+- View (`INT4_TBL`, [f1#x])
+- Project [cast(f1#x as int) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT f1 AS ten FROM FLOAT8_TBL
UNION ALL
SELECT f1 FROM INT4_TBL
-- !query analysis
Union false, false
:- Project [f1#x AS ten#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias int4_tbl
+- View (`INT4_TBL`, [f1#x])
+- Project [cast(f1#x as int) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT f1 AS five FROM FLOAT8_TBL
WHERE f1 BETWEEN -1e6 AND 1e6
UNION
SELECT f1 FROM INT4_TBL
WHERE f1 BETWEEN 0 AND 1000000
ORDER BY 1
-- !query analysis
Sort [five#x ASC NULLS FIRST], true
+- Distinct
+- Union false, false
:- Project [f1#x AS five#x]
: +- Filter between(f1#x, -1000000.0, 1000000.0)
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- Filter between(f1#x, 0, 1000000)
+- SubqueryAlias int4_tbl
+- View (`INT4_TBL`, [f1#x])
+- Project [cast(f1#x as int) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST], true
+- Intersect false
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST], true
+- Intersect All true
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST], true
+- Except false
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q2 FROM int8_tbl EXCEPT ALL SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST], true
+- Except All true
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST], true
+- Except All true
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Distinct
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except false
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except All true
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except All true
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Distinct
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
(SELECT 1,2,3 UNION SELECT 4,5,6) INTERSECT SELECT 4,5,6
-- !query analysis
Intersect false
:- Distinct
: +- Union false, false
: :- Project [1 AS 1#x, 2 AS 2#x, 3 AS 3#x]
: : +- OneRowRelation
: +- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
: +- OneRowRelation
+- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
+- OneRowRelation
-- !query
(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) INTERSECT SELECT 4,5,6
-- !query analysis
Intersect false
:- Sort [1#x ASC NULLS FIRST, 2#x ASC NULLS FIRST], true
: +- Distinct
: +- Union false, false
: :- Project [1 AS 1#x, 2 AS 2#x, 3 AS 3#x]
: : +- OneRowRelation
: +- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
: +- OneRowRelation
+- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
+- OneRowRelation
-- !query
(SELECT 1,2,3 UNION SELECT 4,5,6) EXCEPT SELECT 4,5,6
-- !query analysis
Except false
:- Distinct
: +- Union false, false
: :- Project [1 AS 1#x, 2 AS 2#x, 3 AS 3#x]
: : +- OneRowRelation
: +- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
: +- OneRowRelation
+- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
+- OneRowRelation
-- !query
(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) EXCEPT SELECT 4,5,6
-- !query analysis
Except false
:- Sort [1#x ASC NULLS FIRST, 2#x ASC NULLS FIRST], true
: +- Distinct
: +- Union false, false
: :- Project [1 AS 1#x, 2 AS 2#x, 3 AS 3#x]
: : +- OneRowRelation
: +- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
: +- OneRowRelation
+- Project [4 AS 4#x, 5 AS 5#x, 6 AS 6#x]
+- OneRowRelation
-- !query
select count(*) from
( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss
-- !query analysis
Aggregate [count(1) AS count(1)#xL]
+- SubqueryAlias ss
+- Intersect false
:- Project [unique1#x]
: +- SubqueryAlias spark_catalog.default.tenk1
: +- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
+- Project [fivethous#x]
+- SubqueryAlias spark_catalog.default.tenk1
+- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
-- !query
select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10
-- !query analysis
Except false
:- Project [unique1#x]
: +- SubqueryAlias spark_catalog.default.tenk1
: +- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
+- Project [unique2#x]
+- Filter NOT (unique2#x = 10)
+- SubqueryAlias spark_catalog.default.tenk1
+- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
-- !query
select count(*) from
( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss
-- !query analysis
Aggregate [count(1) AS count(1)#xL]
+- SubqueryAlias ss
+- Intersect false
:- Project [unique1#x]
: +- SubqueryAlias spark_catalog.default.tenk1
: +- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
+- Project [fivethous#x]
+- SubqueryAlias spark_catalog.default.tenk1
+- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
-- !query
select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10
-- !query analysis
Except false
:- Project [unique1#x]
: +- SubqueryAlias spark_catalog.default.tenk1
: +- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
+- Project [unique2#x]
+- Filter NOT (unique2#x = 10)
+- SubqueryAlias spark_catalog.default.tenk1
+- Relation spark_catalog.default.tenk1[unique1#x,unique2#x,two#x,four#x,ten#x,twenty#x,hundred#x,thousand#x,twothousand#x,fivethous#x,tenthous#x,odd#x,even#x,stringu1#x,stringu2#x,string4#x] parquet
-- !query
SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl ORDER BY 1
-- !query analysis
Sort [f1#x ASC NULLS FIRST], true
+- Intersect false
:- Project [f1#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias int4_tbl
+- View (`INT4_TBL`, [f1#x])
+- Project [cast(f1#x as int) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl ORDER BY 1
-- !query analysis
Sort [f1#x ASC NULLS FIRST], true
+- Except false
:- Project [f1#x]
: +- SubqueryAlias float8_tbl
: +- View (`FLOAT8_TBL`, [f1#x])
: +- Project [cast(f1#x as double) AS f1#x]
: +- Project [f1#x]
: +- SubqueryAlias v
: +- Project [col1#x AS f1#x]
: +- LocalRelation [col1#x]
+- Project [cast(f1#x as double) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias int4_tbl
+- View (`INT4_TBL`, [f1#x])
+- Project [cast(f1#x as int) AS f1#x]
+- Project [f1#x]
+- SubqueryAlias v
+- Project [col1#x AS f1#x]
+- LocalRelation [col1#x]
-- !query
SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Union false, false
:- Intersect false
: :- Project [q1#xL]
: : +- SubqueryAlias int8_tbl
: : +- View (`INT8_TBL`, [q1#xL, q2#xL])
: : +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: : +- Project [q1#xL, q2#xL]
: : +- SubqueryAlias v
: : +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: : +- LocalRelation [col1#xL, col2#xL]
: +- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Intersect false
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Union false, false
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl ORDER BY 1))) UNION ALL SELECT q2 FROM int8_tbl
-- !query analysis
Union false, false
:- Sort [q1#xL ASC NULLS FIRST], true
: +- Intersect false
: :- Project [q1#xL]
: : +- SubqueryAlias int8_tbl
: : +- View (`INT8_TBL`, [q1#xL, q2#xL])
: : +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: : +- Project [q1#xL, q2#xL]
: : +- SubqueryAlias v
: : +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: : +- LocalRelation [col1#xL, col2#xL]
: +- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except false
:- Union false, false
: :- Project [q1#xL]
: : +- SubqueryAlias int8_tbl
: : +- View (`INT8_TBL`, [q1#xL, q2#xL])
: : +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: : +- Project [q1#xL, q2#xL]
: : +- SubqueryAlias v
: : +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: : +- LocalRelation [col1#xL, col2#xL]
: +- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1)))
-- !query analysis
Union false, false
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Sort [q2#xL ASC NULLS FIRST], true
+- Except false
:- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
(((SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except false
:- Union false, false
: :- Project [q1#xL]
: : +- SubqueryAlias int8_tbl
: : +- View (`INT8_TBL`, [q1#xL, q2#xL])
: : +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: : +- Project [q1#xL, q2#xL]
: : +- SubqueryAlias v
: : +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: : +- LocalRelation [col1#xL, col2#xL]
: +- Project [q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1,q2 FROM int8_tbl EXCEPT SELECT q2,q1 FROM int8_tbl
ORDER BY q2,q1
-- !query analysis
Sort [q2#xL ASC NULLS FIRST, q1#xL ASC NULLS FIRST], true
+- Except false
:- Project [q1#xL, q2#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q2#xL, q1#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "UNRESOLVED_COLUMN.WITH_SUGGESTION",
"sqlState" : "42703",
"messageParameters" : {
"objectName" : "`q2`",
"proposal" : "`q1`"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 65,
"stopIndex" : 66,
"fragment" : "q2"
} ]
}
-- !query
SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1))) ORDER BY 1
-- !query analysis
Sort [q1#xL ASC NULLS FIRST], true
+- Except false
:- Project [q1#xL]
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- GlobalLimit 1
+- LocalLimit 1
+- Sort [q2#xL ASC NULLS FIRST], true
+- Project [q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
(((((select * from int8_tbl)))))
-- !query analysis
Project [q1#xL, q2#xL]
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
select * from range(1,5) union select * from range(1,3)
-- !query analysis
Distinct
+- Union false, false
:- Project [id#xL]
: +- Range (1, 5, step=1)
+- Project [id#xL]
+- Range (1, 3, step=1)
-- !query
select * from range(1,6) union all select * from range(1,4)
-- !query analysis
Union false, false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) intersect select * from range(1,4)
-- !query analysis
Intersect false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) intersect all select * from range(1,4)
-- !query analysis
Intersect All true
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) except select * from range(1,4)
-- !query analysis
Except false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) except all select * from range(1,4)
-- !query analysis
Except All true
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) union select * from range(1,4)
-- !query analysis
Distinct
+- Union false, false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) union all select * from range(1,4)
-- !query analysis
Union false, false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) intersect select * from range(1,4)
-- !query analysis
Intersect false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) intersect all select * from range(1,4)
-- !query analysis
Intersect All true
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) except select * from range(1,4)
-- !query analysis
Except false
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
select * from range(1,6) except all select * from range(1,4)
-- !query analysis
Except All true
:- Project [id#xL]
: +- Range (1, 6, step=1)
+- Project [id#xL]
+- Range (1, 4, step=1)
-- !query
SELECT cast('3.4' as decimal(38, 18)) UNION SELECT 'foo'
-- !query analysis
Distinct
+- Union false, false
:- Project [cast(CAST(3.4 AS DECIMAL(38,18))#x as double) AS CAST(3.4 AS DECIMAL(38,18))#x]
: +- Project [cast(3.4 as decimal(38,18)) AS CAST(3.4 AS DECIMAL(38,18))#x]
: +- OneRowRelation
+- Project [cast(foo#x as double) AS foo#x]
+- Project [foo AS foo#x]
+- OneRowRelation
-- !query
SELECT * FROM
(SELECT 1 AS t, 2 AS x
UNION
SELECT 2 AS t, 4 AS x) ss
WHERE x < 4
ORDER BY x
-- !query analysis
Sort [x#x ASC NULLS FIRST], true
+- Project [t#x, x#x]
+- Filter (x#x < 4)
+- SubqueryAlias ss
+- Distinct
+- Union false, false
:- Project [1 AS t#x, 2 AS x#x]
: +- OneRowRelation
+- Project [2 AS t#x, 4 AS x#x]
+- OneRowRelation
-- !query
SELECT * FROM
(SELECT 1 AS t, id as x from range(1,11)
UNION
SELECT 2 AS t, 4 AS x) ss
WHERE x < 4
ORDER BY x
-- !query analysis
Sort [x#xL ASC NULLS FIRST], true
+- Project [t#x, x#xL]
+- Filter (x#xL < cast(4 as bigint))
+- SubqueryAlias ss
+- Distinct
+- Union false, false
:- Project [1 AS t#x, id#xL AS x#xL]
: +- Range (1, 11, step=1)
+- Project [t#x, cast(x#x as bigint) AS x#xL]
+- Project [2 AS t#x, 4 AS x#x]
+- OneRowRelation
-- !query
SELECT * FROM
(SELECT 1 AS t, int((random()*3)) AS x
UNION
SELECT 2 AS t, 4 AS x) ss
WHERE x > 3
ORDER BY x
-- !query analysis
[Analyzer test output redacted due to nondeterminism]
-- !query
select distinct q1 from
(select distinct * from int8_tbl i81
union all
select distinct * from int8_tbl i82) ss
where q2 = q2
-- !query analysis
Distinct
+- Project [q1#xL]
+- Filter (q2#xL = q2#xL)
+- SubqueryAlias ss
+- Union false, false
:- Distinct
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias i81
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Distinct
+- Project [q1#xL, q2#xL]
+- SubqueryAlias i82
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
select distinct q1 from
(select distinct * from int8_tbl i81
union all
select distinct * from int8_tbl i82) ss
where -q1 = q2
-- !query analysis
Distinct
+- Project [q1#xL]
+- Filter (-q1#xL = q2#xL)
+- SubqueryAlias ss
+- Union false, false
:- Distinct
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias i81
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Distinct
+- Project [q1#xL, q2#xL]
+- SubqueryAlias i82
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]
-- !query
select * from
(select *, 0 as x from int8_tbl a
union all
select *, 1 as x from int8_tbl b) ss
where (x = 0) or (q1 >= q2 and q1 <= q2)
-- !query analysis
Project [q1#xL, q2#xL, x#x]
+- Filter ((x#x = 0) OR ((q1#xL >= q2#xL) AND (q1#xL <= q2#xL)))
+- SubqueryAlias ss
+- Union false, false
:- Project [q1#xL, q2#xL, 0 AS x#x]
: +- SubqueryAlias a
: +- SubqueryAlias int8_tbl
: +- View (`INT8_TBL`, [q1#xL, q2#xL])
: +- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
: +- Project [q1#xL, q2#xL]
: +- SubqueryAlias v
: +- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
: +- LocalRelation [col1#xL, col2#xL]
+- Project [q1#xL, q2#xL, 1 AS x#x]
+- SubqueryAlias b
+- SubqueryAlias int8_tbl
+- View (`INT8_TBL`, [q1#xL, q2#xL])
+- Project [cast(q1#xL as bigint) AS q1#xL, cast(q2#xL as bigint) AS q2#xL]
+- Project [q1#xL, q2#xL]
+- SubqueryAlias v
+- Project [col1#xL AS q1#xL, col2#xL AS q2#xL]
+- LocalRelation [col1#xL, col2#xL]