order by some join-related tests

This commit is contained in:
vdimir 2022-06-07 13:59:30 +00:00 committed by Vladimir C
parent 9f5e30a5d3
commit 34d2a0a4db
8 changed files with 24 additions and 15 deletions

View File

@ -6,4 +6,5 @@ ANY LEFT JOIN
(
SELECT number * 2 AS k, number AS joined FROM system.numbers LIMIT 10
) AS b
USING k;
USING k
ORDER BY k;

View File

@ -6,4 +6,5 @@ ALL INNER JOIN
(
SELECT intDiv(number, 2) AS k, number AS joined FROM system.numbers LIMIT 10
) AS b
USING k;
USING k
ORDER BY k;

View File

@ -6,4 +6,5 @@ ALL LEFT JOIN
(
SELECT reinterpretAsString(intDiv(number, 2) + reinterpretAsUInt8('A')) AS k, number AS joined FROM system.numbers LIMIT 10
) js2
USING k;
USING k
ORDER BY k;

View File

@ -1 +1,6 @@
SELECT number, number / 2 AS n, j1, j2 FROM system.numbers ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) js2 USING n LIMIT 10
SELECT * FROM (
SELECT number, number / 2 AS n, j1, j2
FROM system.numbers
ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) js2
USING n LIMIT 10
) ORDER BY n;

View File

@ -14,4 +14,5 @@ FROM
arrayJoin([1, 3, 2]) AS key1,
0 AS key2,
999 AS table_1
) js2 USING key2, key1;
) js2 USING key2, key1
ORDER BY key1;

View File

@ -1 +1 @@
SELECT * FROM numbers(3) AS a ANY LEFT JOIN numbers(3) AS b ON a.number = b.number
SELECT * FROM numbers(3) AS a ANY LEFT JOIN numbers(3) AS b ON a.number = b.number ORDER BY a.number;

View File

@ -26,14 +26,14 @@ values ('1', 'John'), ('2', 'Jack'), ('3', 'Daniel'), ('4', 'James'), ('5', 'Ama
insert into children (id, childName)
values ('1', 'Robert'), ('1', 'Susan'), ('3', 'Sarah'), ('4', 'David'), ('4', 'Joseph'), ('5', 'Robert');
select * from persons all inner join children using id;
select * from persons all inner join (select * from children) as j using id;
select * from (select * from persons) as s all inner join (select * from children ) as j using id;
select * from persons all inner join children using id order by id;
select * from persons all inner join (select * from children) as j using id order by id;
select * from (select * from persons) as s all inner join (select * from children ) as j using id order by id;
--
set joined_subquery_requires_alias = 0;
select * from persons all inner join (select * from children) using id;
select * from (select * from persons) all inner join (select * from children) using id;
select * from (select * from persons) as s all inner join (select * from children) using id;
select * from persons all inner join (select * from children) using id order by id;
select * from (select * from persons) all inner join (select * from children) using id order by id;
select * from (select * from persons) as s all inner join (select * from children) using id order by id;
drop table persons;
drop table children;

View File

@ -15,7 +15,7 @@ SELECT * FROM testJoinTable;
DROP TABLE testJoinTable;
SELECT '-';
DROP TABLE IF EXISTS master;
DROP TABLE IF EXISTS transaction;
@ -38,8 +38,8 @@ DROP TABLE IF EXISTS tbl;
CREATE TABLE tbl (eventDate Date, id String) ENGINE = MergeTree() PARTITION BY tuple() ORDER BY eventDate;
CREATE TABLE some_join (id String, value String) ENGINE = Join(ANY, LEFT, id) SETTINGS any_join_distinct_right_table_keys = 1;
SELECT * FROM tbl AS t ANY LEFT JOIN some_join USING (id);
SELECT * FROM tbl AS t ANY LEFT JOIN some_join AS d USING (id);
SELECT * FROM tbl AS t ANY LEFT JOIN some_join USING (id) ORDER BY id;
SELECT * FROM tbl AS t ANY LEFT JOIN some_join AS d USING (id) ORDER BY id;
-- TODO SELECT t.*, d.* FROM tbl AS t ANY LEFT JOIN some_join AS d USING (id);
DROP TABLE some_join;